01 2022 档案

摘要:A #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int T, n; int main() { cin >> T; while (T -- ) { cin >> n; string s; cin >> s; 阅读全文
posted @ 2022-01-31 10:29 Angels_of_Death 阅读(66) 评论(0) 推荐(0)
摘要:A #include <bits/stdc++.h> #define int long long using namespace std; int T, n, m; signed main() { cin >> n; int a = 2147483648; int b = a * -1; a --; 阅读全文
posted @ 2022-01-31 10:26 Angels_of_Death 阅读(68) 评论(0) 推荐(0)
摘要:A #include <bits/stdc++.h> using namespace std; int a[10010], b[10010]; int main() { int T; cin >> T; while (T -- ) { int n; cin >> n; for (int i = 1; 阅读全文
posted @ 2022-01-30 15:02 Angels_of_Death 阅读(40) 评论(0) 推荐(0)
摘要:A class Solution { public: int findFinalValue(vector<int>& nums, int original) { for (int i = 1; i <= 1000; i ++ ) { for (auto x : nums) { if (x == or 阅读全文
posted @ 2022-01-30 13:42 Angels_of_Death 阅读(23) 评论(0) 推荐(0)
摘要:A 首先把原数组中的数按题目要求进行转化 状态表示$f[i][j]$表示从前$i$个选,凑成的数组为$j$的所有方案数 #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 10 阅读全文
posted @ 2022-01-27 14:25 Angels_of_Death 阅读(65) 评论(0) 推荐(0)
摘要: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, 阅读全文
posted @ 2022-01-26 23:20 Angels_of_Death 阅读(288) 评论(0) 推荐(0)
摘要:黑白染色模板题 首先通过DFS缩点,将所有相同状态的连通块缩成一个点 之后枚举每一个点进行BFS,计算变成最终状态的最小值 #include<bits/stdc++.h> using namespace std; const int N = 50, M = 2500; int T, n, m, cn 阅读全文
posted @ 2022-01-26 09:48 Angels_of_Death 阅读(30) 评论(0) 推荐(0)
摘要:$f[A][B][C][D][X][Y]$表示当前由A张红桃,B张黑桃,C张梅花,D张方片,且小王的状态为X,大王的状态为Y的情况的期望的最小值 此时可以通过枚举每一个变量的状态得到状态转移 #include <bits/stdc++.h> using namespace std; const in 阅读全文
posted @ 2022-01-26 09:40 Angels_of_Death 阅读(31) 评论(0) 推荐(0)
摘要:正推概率,逆推期望 $f[i]$表示从$i$到$N$的概率 递推方程:\(f[i] = \sum (\frac{1}{k} \times (w[i] + f[j]))\) #include <bits/stdc++.h> using namespace std; const int N = 1e5 阅读全文
posted @ 2022-01-25 16:06 Angels_of_Death 阅读(22) 评论(0) 推荐(0)
摘要:二分 + 前缀和 首先我们可以二分平均数 对于长度不小于L的子段, (1)等价于原数组中的每个数减去平均数,计算度不小于L的子段使得和大于0 (2)通过一个变量维护,$(0,i-L)$中前缀和的最小值 #include <bits/stdc++.h> using namespace std; con 阅读全文
posted @ 2022-01-24 17:42 Angels_of_Death 阅读(30) 评论(0) 推荐(0)
摘要:AcWing 3164. 线性基 由高到低枚举二进制的每一位 通过高斯消元化为上三角矩阵 后将所有元素异或即可 #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 10; in 阅读全文
posted @ 2022-01-24 16:01 Angels_of_Death 阅读(79) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2022-01-24 10:13 Angels_of_Death 阅读(93) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2022-01-23 16:05 Angels_of_Death 阅读(27) 评论(0) 推荐(0)
摘要: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() - 阅读全文
posted @ 2022-01-23 14:33 Angels_of_Death 阅读(32) 评论(0) 推荐(0)
摘要:A class Solution { public: int countElements(vector<int>& nums) { int minn = 0x3f3f3f3f, maxx = 0xcfcfcfcf; for (auto x : nums) minn = min(minn, x), m 阅读全文
posted @ 2022-01-23 12:01 Angels_of_Death 阅读(25) 评论(0) 推荐(0)
摘要:A 双指针 #include <bits/stdc++.h> #define PII pair<int, int> using namespace std; const int N = 2e5 + 10; int T, n, d; int a[N]; int main() { scanf("%d", 阅读全文
posted @ 2022-01-22 21:53 Angels_of_Death 阅读(37) 评论(0) 推荐(0)
摘要:A 签到题 #include <bits/stdc++.h> using namespace std; int T, n; int main() { cin >> T; while (T -- ) { cin >> n; int sum = 0; vector<string> v1, v2; str 阅读全文
posted @ 2022-01-22 16:53 Angels_of_Death 阅读(339) 评论(0) 推荐(0)