摘要: 1 /**\ 2 https://codeforces.com/contest/1426/problem/C 3 先自增再进行复制,这样最优,把一个数从1变成x,需要x-1次。 4 然后暴力枚举一遍,找到最小值就行了 5 \**/ 6 #include <bits/stdc++.h> 7 using 阅读全文
posted @ 2022-03-03 22:10 std&ice 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 1 int primes[N], cnt; // primes[]存储所有素数 2 bool st[N]; // st[x]存储x是否被筛掉 3 4 void get_primes(int n) 5 { 6 for (int i = 2; i <= n; i ++ ) 7 { 8 if (!st[i 阅读全文
posted @ 2022-03-03 15:18 std&ice 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑