多学习。

上一页 1 2 3 4 5 6 ··· 16 下一页
摘要: AcWing2.01背包问题 题解 二维 #include <iostream> using namespace std; const int N = 1010; int dp[N][N]; int v[N], w[N]; int main() { int n, V; cin >> n >> V; 阅读全文
posted @ 2022-06-13 16:53 czyaaa 阅读(22) 评论(0) 推荐(0) 编辑
摘要: AcWing204.表达整数的奇怪方式 题解 模板 根据题目变形 #include <iostream> using namespace std; typedef long long LL; LL exgcd(LL a, LL b, LL &x, LL &y) { if(!b) { x = 1, y 阅读全文
posted @ 2022-06-12 12:42 czyaaa 阅读(27) 评论(0) 推荐(0) 编辑
摘要: AcWing878.线性同余方程 题解 #include <iostream> using namespace std; int exgcd(int a, int b, int &x, int &y) { if(b == 0) { x = 1, y = 0; return a; } int d = 阅读全文
posted @ 2022-06-12 10:04 czyaaa 阅读(24) 评论(0) 推荐(0) 编辑
摘要: AcWing877.扩展欧几里得算法 题解与证明 #include <iostream> using namespace std; int exgcd(int a, int b, int &x, int &y) { if(b == 0) { x = 1, y = 0; return a; } int 阅读全文
posted @ 2022-06-12 09:29 czyaaa 阅读(25) 评论(0) 推荐(0) 编辑
摘要: AcWing876.快速幂求逆元 题解 #include <iostream> using namespace std; typedef long long LL; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int qm 阅读全文
posted @ 2022-06-09 21:36 czyaaa 阅读(37) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2022.cnblogs.com/blog/2425439/202206/2425439-20220609213156081-39622933.jpg) 阅读全文
posted @ 2022-06-09 21:32 czyaaa 阅读(71) 评论(0) 推荐(0) 编辑
摘要: AcWing875.快速幂 题解 #include <iostream> using namespace std; typedef long long LL; int main() { int n, a, b, p; cin >> n; while(n -- ) { int res = 1; cin 阅读全文
posted @ 2022-06-09 21:30 czyaaa 阅读(24) 评论(0) 推荐(0) 编辑
摘要: AcWing874.筛法求欧拉函数 题解 #include <iostream> using namespace std; typedef long long LL; const int N = 1e6 + 10; int primes[N], eulars[N], cnt; bool st[N]; 阅读全文
posted @ 2022-06-07 23:18 czyaaa 阅读(28) 评论(0) 推荐(0) 编辑
摘要: AcWing873.欧拉函数 证明与题解 #include <iostream> using namespace std; int phi(int x) { int res = x; for(int i = 2; i <= x / i; ++i) { if(x % i == 0) { res = r 阅读全文
posted @ 2022-06-07 21:19 czyaaa 阅读(70) 评论(0) 推荐(1) 编辑
摘要: AcWing872.最大公约数 题解 #include <iostream> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { int n, x, y; cin >> n 阅读全文
posted @ 2022-06-02 20:34 czyaaa 阅读(21) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 16 下一页
点击右上角即可分享
微信分享提示