摘要:
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; 阅读全文
摘要:
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 阅读全文
摘要:
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 = 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
 阅读全文
摘要:
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 阅读全文
摘要:
AcWing874.筛法求欧拉函数 题解 #include <iostream> using namespace std; typedef long long LL; const int N = 1e6 + 10; int primes[N], eulars[N], cnt; bool st[N]; 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文