摘要: 1 #include <bits/stdc++.h> 2 #define int long long 3 using namespace std; 4 const int N = 105; 5 const int mod = 1e7 + 9; 6 int n, k; 7 struct node { 阅读全文
posted @ 2022-03-03 15:14 std&ice 阅读(48) 评论(0) 推荐(0) 编辑
摘要: int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a,int b) { return a / gcd(a, b) * b; } 阅读全文
posted @ 2022-03-03 15:09 std&ice 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 乘法 1 #include <bits/stdc++.h> 2 using namespace std; 3 vector<int> mul(vector<int> &A, vector<int> &B) 4 { 5 vector<int> C(A.size() + B.size()); 6 7 f 阅读全文
posted @ 2022-03-03 15:03 std&ice 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 整数二分 1 /**\ 2 check()函数用来检查是否具有某种性质 3 r = mid 适用于答案往左逼近的情况 4 l = mid 适用于区间答案往右逼近的情况(例如最小最大值) 5 \**/ 6 int bs1(int l, int r) 7 { 8 while (l < r) 9 { 10 阅读全文
posted @ 2022-03-03 14:49 std&ice 阅读(63) 评论(1) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define fi first 4 #define se second 5 #define go continue 6 #define woc puts(""); 7 #define int l 阅读全文
posted @ 2022-03-03 12:15 std&ice 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define fi first 4 #define se second 5 #define go continue 6 #define woc puts(""); 7 #define int l 阅读全文
posted @ 2022-03-03 11:42 std&ice 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 https://codeforces.com/problemset/problem/1622/C 3 贪心: 4 先将数组排序,要么减小a[1]值,要么从后面开始变后面的数->a[1],枚举x y就可 6 后附公式证明 5 \**/ 6 #include <bits/stdc++. 阅读全文
posted @ 2022-03-01 23:42 std&ice 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 https://codeforces.com/contest/1627/problem/C 3 想要满足能够赋值的条件,必须所有点的度都不能>3 4 那么树退化成了链,就op记下输出格式,然后ans记录dfs的结果 5 由于链式 2 3 2 3 就满足prime path 6 \* 阅读全文
posted @ 2022-03-01 22:25 std&ice 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 线段树:区间查询 区间修改 3 input: 4 5 5 5 1 5 4 2 3 6 2 2 4 7 1 2 3 2 8 2 3 4 9 1 1 5 1 10 2 1 4 11 output: 12 11 13 8 14 20 15 \**/ 16 #include <bits/s 阅读全文
posted @ 2022-03-01 09:12 std&ice 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 const int N = 10010; 6 7 int n, m; 8 9 int cnt = 0; 10 struct node 11 { 12 int to, w, nextt; 1 阅读全文
posted @ 2022-02-25 10:52 std&ice 阅读(51) 评论(0) 推荐(0) 编辑