hong kong programming the
diverta 2019 Programming Contest 2
A - Ball Distribution \(k=1\) 时答案为 \(0\),否则答案为 \(n-k\)。 #include<iostream> #include<cstdio> using namespace std; int n,k; int main() { scanf("%d%d",&n ......
Dwango Programming Contest V
A - Thumbnail 直接按照题意模拟。。。 #include<iostream> #include<cstdio> #include<cmath> using namespace std; const int N=105; int n; int a[N]; int main() { scan ......
NIKKEI Programming Contest 2019-2
A - Sum of Two Integers 分奇偶讨论一下就好了,答案为 \(\lfloor \frac{n-1}\{2\}\rfloor\)。 #include<iostream> #include<cstdio> using namespace std; int n; int main() ......
Dwango Programming Contest 6th
A - Falling Asleep 找到第一个相等的位置,然后暴力往后加就是了。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n; string s[N]; string t; int a ......
M-SOLUTIONS Programming Contest
A - Sum of Interior Angles 答案为 \(180(n-2)\)。 #include<iostream> #include<cstdio> using namespace std; int n; int main() { scanf("%d",&n); printf("%d", ......
diverta 2019 Programming Contest
A - Consecutive Integers 答案为 \(n-k+1\)。 #include<iostream> #include<cstdio> using namespace std; int n,k; int main() { scanf("%d%d",&n,&k); printf("%d ......
CS61A: Structure and Interpretation of Computer Programs 笔记
Functions Environment Diagrams:左侧为 Frames,右侧为 Objects。 Name 类似变量名,它们存储在 Frame 中,指向各种各样的 Objects,比如值或函数。一个 Name 同时只能指向一个 Object,但可以改变自身指向,不受“类型”影响(Name ......
[892] Change the background color of a table in a Word document
ref: python-docx Changing Table Cell Background Color. To change the background color of a table in a Word document using Python, you can use the pyth ......
How to get the original size of an image using JavaScript All In One
How to get the original size of an image using JavaScript All In One
如何使用 JavaScript 获取一个图片像的原始大小
naturalWidth & naturalHeight
aspect ratio / 纵横比
......
Go - Using channels to receive interrupts in a program
Within the Kubernetes deployment environment, applications will actually be sent the SIGTERM signal first if it has been decided the pod holding the a ......
Knights of the Round Table
prologue 相信很多人都感觉这个题不就是求一下这个二分图的最大独立集嘛,有什么难的,(劈里啪啦、库里跨啦、叮里哐啷)好,不对,好好好,题解! analysis 这个题目实际上并不是一个完整的最大独立集问题,因为在这个题里面,是可以有相互仇恨的骑士的,只要不让他们二人坐成同桌就行。 那么我们就不 ......
ERROR: Could not find a version that satisfies the requirement selunium (from versions: none)
错误信息 ERROR: Could not find a version that satisfies the requirement selenium (from versions: none) ERROR: No matching distribution found for selenium ......
[LeetCode] 2582. Pass the Pillow
There are n people standing in a line labeled from 1 to n. The first person in the line is holding a pillow initially. Every second, the person holdin ......
「解题报告」The 1st Universal Cup. Stage 3: Poland
大概按难度排序。签到题没写。 QOJ M. Minor Evil 有 \(n\) 个球与 \(k\) 个操作,初始所有球都是白色的。第 \(i\) 个操作为如果 \(a_i\) 是白色的,那么就将 \(b_i\) 染成黑色,否则什么都不做。你可以选择每个操作执行或不执行,但是不能改变操作之间的相对顺 ......
[888] How to get the directory of the current Python file
To get the directory of the current Python file, you can use the os.path module in combination with the __file__ attribute. Here's how you can do it: ......
VSCode 安装插件 Unity 后,一直弹 The .NET Core SDK cannot be located
如题。 明明已经安装了.Net 7.0。并且添加到了 PATH 中。 (也就是在 终端/CMD 可以通过 dotnet 命令访问到。) 但 Vscode 还是一直弹 The .NET Core SDK cannot be located。 然后开始下载 .Net7.0。 解决方案 写在了 .NET ......
The 2023 ICPC Asia Regionals Online Contest (2) MDIELK
The 2023 ICPC Asia Regionals Online Contest (2) MDIELK M Dirty Work 题意:总共有\(n\)个问题,对于第\(i\)个问题需要\(a_i\)分钟。你可以随便选择一个没过的题去写,写完以后马上交,你有\(p_i\)的概率会错,错了不能跳 ......
The 2nd Universal Cup. Stage 2- SPb
A. Mixed Messages dp[i][j]表示前i位,选择\(j\)个移动到一起的最小花费。 #include<bits/stdc++.h> using namespace std; #define int long long constexpr int inf = 1E9; int32_ ......
The 2023 ICPC Asia Regionals Online Contest (2)
Preface 这场打的有点捞说实话,两个小时出头的时候写完6个题就开始坐牢了 K题由于我习惯性地不写数论就扔给徐神了,徐神也是很有思路写了个看着就很对的东西,但不知道为什么过不去 赛后发现K其实是个很傻逼的题,类似的思路我最近补CF的时候还遇到过,但就是没细想 虽然当时下机的时候和祁神把A题的正解 ......
nginx: The plain HTTP request was sent to HTTPS port
问题描述 The plain HTTP request was sent to HTTPS port 当访问用http时则报错。用https时不报错。 检查配置: server { listen 80 ssl; server_name hngj.zxynyxxx.cn; ssl_certificat ......
the solution of Mining Your Own Business
the description of problem (我看的是 PDF 里面的原题所以这里描述会和题目不一样,但是大意一致) 给定一个未必连通的无向图,问最少在几个点设置出口,可以保证任意一个点坍塌后,工人们仍然可以从出口逃生,同时问设置最少出口的方案数量。 thoughts & solution ......
[CF1810G] The Maximum Prefix
题目描述 You're going to generate an array $ a $ with a length of at most $ n $ , where each $ a_{i} $ equals either $ 1 $ or $ -1 $ . You generate this a ......
CF1801D The way home
原题 翻译 非常好的一个题,有两种做法 方法1:flody+dp 首先我们确定一个最优行走方案:从 \(1\) 号节点赚到足够钱后通过最短路到达 \(x_1\) ,在 \(x_1\) 赚够足够钱后到达 \(x_2\) ,在 \(x_2\) 赚够足够钱后到达 \(x_3\) ,如此往复后到达终点 现在 ......
CodeForces 715E Complete the Permutations
洛谷传送门 CF 传送门 最小交换次数等于 \(n - \text{环数}\)。所以题目要我们统计把 \(p, q\) 补全成排列,连边 \(p_i \to q_i\),环数 \(= i\) 的方案数。 考虑把边根据 \(p_i, q_i\) 的是否已知状态分成四类: \(p \to q\) \(p ......
CF1710D Recover the Tree
题目链接 一个比较显然的思路就是:我们按照右端点从小到大的顺序(右端点相同按左端点从大到小)去考虑每个好的区间。 由于是连通性问题,不难想到用并查集去实时维护连通性。 根据定义,一个好的区间必定对应了一个连通块;我们考虑的是好的区间,所以当前并查集中的每个连通块必定都是一个区间。而在加入某个点前,这 ......
git pull代码时提示:Your local changes to the following files would be overwritten by merge
内容来自对 chatgpt 的咨询 这个错误提示意味着你在执行git pull命令时,Git发现你当前工作目录中的一些文件与远程仓库的变更产生了冲突。这可能是因为你在本地修改了一些文件,而远程仓库也有更新。Git不允许在有未提交的本地修改时直接执行git pull,以防止可能的冲突。 要解决这个问题 ......
UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.解决办法
87iuiu由于ii from torchvision import models # 旧版本的写法,将在未来的torchvision 0.15版本中被Deprecated model_old = models.resnet50(pretrained=True) # deprecated model ......
CF1862G The Great Equalizer
题目链接 先不考虑修改操作。 直接模拟题目意思,可以发现最后留下的一定是最小的数字(因为相同的数每次会保留第一个)。我当时是顺着这个思路做的题目,现在想想反过来想好像会让问题变得更简单,即认为每次保留最后一个相同的数字。 那么现在每次留下的就是最后一个数字,显然每次操作会让这个数字加一,只需要考虑一 ......
CF842A Kirill And The Game
如果考虑 \([x,y]\) 中什么位置能乘到 \([l,r]\) 就比较麻烦,简单的做法是考虑 \(l\) 和 \(r\) 对应到 \([x,y]\) 中的位置。左边界至少是 \(\frac{l-1}{k}+1\),右边界至多是 \(\frac{r}{k}\),判断一下与 \([x,y]\) 是否 ......
How to use a shell script to check whether a command had been installed in the Linux server All In One
How to use a shell script to check whether a command had been installed in the Linux server All In One
shell script error [: :需要整数表达式 / [: -eq:需要一元表达... ......