摘要:
https://ac.nowcoder.com/acm/contest/1099 question I 2019 点分治,第一次做的点分治。要先找树的重心,然后分治。 cpp include using namespace std; typedef long long ll; const int I 阅读全文
摘要:
```cpp const int MOD = 10007; ll n, m; ll qpow(ll x, ll n) { ll res = 1; while(n) { if(n & 1) res = res * x % MOD; x = x * x % MOD; n >>= 1; } ret... 阅读全文
摘要:
https://www.acwing.com/problem/content/167/ 18只猫,每只猫有重量,车有载重上限,求最小的数量的车把猫装完,保证有解。 但如果从搜索的角度来看的话,是建一个数组表示车,然后从最大的猫开始枚举它在哪辆车里。 阅读全文
摘要:
https://www.acwing.com/problem/content/description/124/ 参考题解:https://www.acwing.com/solution/acwing/content/955/ 题意:n个小朋友坐成环形,每个小朋友有a[i]颗糖,可以向左右传递,求最小 阅读全文
摘要:
https://www.acwing.com/problem/content/107/ 很显然行和列是独立的,求出平均值之后变成“一个环,交换最小的次数使得各个位置相等”。假设要交换,则考虑最大的数,它要么把货物传递到左边,要么把货物传递到右边。多出来的部分一直累过去,假如多出来的部分是负的则会欠债 阅读全文