摘要:
A 首先把原数组中的数按题目要求进行转化 状态表示$f[i][j]$表示从前$i$个选,凑成的数组为$j$的所有方案数 #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 10 阅读全文
摘要:
A #include <bits/stdc++.h> using namespace std; int main() { puts("All in!"); return 0; } B #include <bits/stdc++.h> using namespace std; int T, n, m, 阅读全文
摘要:
黑白染色模板题 首先通过DFS缩点,将所有相同状态的连通块缩成一个点 之后枚举每一个点进行BFS,计算变成最终状态的最小值 #include<bits/stdc++.h> using namespace std; const int N = 50, M = 2500; int T, n, m, cn 阅读全文
摘要:
AcWing 3164. 线性基 由高到低枚举二进制的每一位 通过高斯消元化为上三角矩阵 后将所有元素异或即可 #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 10; in 阅读全文
摘要:
A #include <bits/stdc++.h> using namespace std; int main() { string s; int a, b; cin >> s >> a >> b; swap(s[a - 1], s[b - 1]); cout << s << endl; retu 阅读全文
摘要:
A #include <bits/stdc++.h> using namespace std; int n, k; struct node { int a, b; }p[110]; bool cmp(node x, node y) { if (x.a == y.a) return x.b > y.b 阅读全文
摘要:
A class Solution { public: int minimumCost(vector<int>& cost) { sort(cost.begin(), cost.end()); vector<int> v; int sum = 0; for (int i = cost.size() - 阅读全文