摘要: 链接 1 #include <bits/stdc++.h> 2 #define go continue 3 #define int long long 4 #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); 5 #defin 阅读全文
posted @ 2022-04-06 17:34 std&ice 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1、分解质因数 1 /* 2 f(n) : 1 - n 中与n互质的个数(gcd(a, b) = 1) 3 n = p1^a1.p2^a2...pn^an 4 f(n) = n * (1 - 1/p1)(1 - 1/p2)...(1 - 1/pn) 5 */ 6 #include <bits/std 阅读全文
posted @ 2022-04-04 14:33 std&ice 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 模板题链接 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 const int N = 110; 5 const double eps = 1e-6; 6 int n; 7 double a[N][N]; 8 9 int solve() 1 阅读全文
posted @ 2022-04-04 11:18 std&ice 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1、判断质数 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 bool is_prime(int n){ 5 if(n < 2) return false; 6 for(int i = 2; i <= n / i; ++i){ 7 if(n 阅读全文
posted @ 2022-04-03 16:13 std&ice 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 模板题链接 1、mod为质数下的普通逆元求法 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 int fp(int a, int b, int c){ 5 int res = 1; 6 while(b){ 7 if(b & 1) res = 阅读全文
posted @ 2022-04-03 11:00 std&ice 阅读(52) 评论(0) 推荐(0) 编辑
摘要: multiset初始化 点击查看代码 multiset<int> set1; //默认升序 multiset<int, less<int> > set2; //等价于上一种方式 multiset<int, greater<int> > set3; //降序 2. multiset常用函数 点击查看代 阅读全文
posted @ 2022-03-30 23:26 std&ice 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 链接 A、Mio visits ACGN Exhibition 1 /* 2 f[i][j][k] : 从(1, 1) -> (i, j)的经过k个0的方案数: 3 { 4 a[i][j] = 0 : f[i][j - 1][k - 1] + f[i - 1][j][k - 1] 5 a[i][j] 阅读全文
posted @ 2022-03-29 09:31 std&ice 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 https://codeforces.com/contest/1167/problem/B 3 每日询问相邻的,能知道5个,最后一个也可以推出来 4 直接dfs暴力匹配就行, 5 询问的时候把结果存下来 6 \**/ 7 #include <bits/stdc++.h> 8 usi 阅读全文
posted @ 2022-03-22 14:40 std&ice 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 https://codeforces.com/contest/1480/problem/C 3 二分不断维护一个区间 4 使得a[l - 1] > a[l], a[r] < a[r + 1] 5 \**/ 6 #include <bits/stdc++.h> 7 using nam 阅读全文
posted @ 2022-03-22 14:08 std&ice 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 1 /**\ 2 https://ac.nowcoder.com/acm/contest/26077/1005 3 从第i列第n行, 第1行m列添加起点, 然后bfs寻找能够分割两个点的墙 4 5 注意: 6 1、方向只能上下左右,因为对角线仍然可以穿过 7 2、处理图的数据的时候可以将-1的墙标记 阅读全文
posted @ 2022-03-21 19:51 std&ice 阅读(78) 评论(0) 推荐(0) 编辑