CF
Ja_King_ZH
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Educational Codeforces Round 120 (Rated for Div. 2) A ~ C
https://codeforces.com/contest/1622/problem/A 题意:给定三个正整数,将其中一个数分为两个数,判断能否构成长方形。 题解:枚举每种情况就行。 int f[4]; bool cmp(int a, int b) { return a > b; } int main() { int t; cin >> t; while (t--) { cin >> f[0] >> f[1] >> f[2]; sor原创 2022-02-02 13:57:43 · 876 阅读 · 0 评论 -
Educational Codeforces Round 122 (Rated for Div. 2) A ~ D
https://codeforces.com/contest/1633/problem/A 题意:通过改变最小次数得到7的倍数,每次只能改变一位。 题解:只需改变各位即可,也就是枚举个位,从0到9,判断能否被7整除。 int main() { int t; cin >> t; while (t--) { int x; string res; cin >> res; x = res[0] - '0'; if (res.size() > 2) x = x原创 2022-02-01 15:00:54 · 963 阅读 · 0 评论 -
Codeforces Round #769 (Div. 2) A ~ C
https://codeforces.com/contest/1632/problem/A 题意:给定一个字符串,由01组成,可以去掉头尾任意数量的字符,问是否可以构成长度大于1的回文串。 题解:当字符串长度为1时,不能,长度为2时,若首尾不同则不能,若大于等于三,则可以。 int main() { int t; cin >> t; while (t--) { int n; string res; cin >> n >> res; if (n原创 2022-01-31 21:48:12 · 1117 阅读 · 0 评论 -
Codeforces Round #768 (Div. 2) A ~ C
https://codeforces.com/contest/1631/problem/A 题意:给定两个数组,可以选择任意下标i,交换ai和bi,使得a数组最大值 * b数组最大值最小。 题解:将ai > bi 的移动到a数组,小于的放在b数组 const int N = 110; int a[N], b[N]; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int m1 = 0原创 2022-01-30 20:23:35 · 383 阅读 · 0 评论 -
C. Balanced Stone Heaps
https://codeforces.com/problemset/problem/1623/C 题意:有n堆石子,第i堆石子有hi个石子,你可以从第3堆开始到第n堆,将d个石子移动到i - 1堆和2d个石子移动到i - 2堆,问最后最大的最小堆为多少。 题解:二分!!!(代码有说明!) #include<iostream> #include<algorithm> #include<cstring> #include<queue> #include<ma原创 2022-01-27 11:25:24 · 913 阅读 · 0 评论 -
Codeforces Round #767 (Div. 2) A ~ D
A.https://codeforces.com/contest/1629/problem/A 题意:给定n和k,以及两个数组a,b(大小为n),若k大于等于ai,则可以获得bi,问能获得的最大价值是多少。 题解,贪心,先找最小的,若大于此时最小的ai,则加上bi,在找次小的。 typedef pair<int, int>PII; const int N = 110; int a[N], b[N]; PII c[N]; int main() { int t; cin >> t;原创 2022-01-23 10:29:47 · 353 阅读 · 0 评论 -
Educational Codeforces Round 121 (Rated for Div. 2) (A ~ C)
A.https://codeforces.com/contest/1626/problem/A 题意:给你个字符串,使得每个字母出现次数不超过两次,输出字符串,使得输出的字符串相同字母距离相同。 题解:sort一下即可 int main() { int t; cin >> t; while (t--) { string s; cin >> s; sort(s.begin(), s.end()); cout << s << endl;原创 2022-01-17 14:10:47 · 601 阅读 · 2 评论 -
Codeforces Round #766 (Div. 2) (A ~ D)
A.https://codeforces.com/contest/1627/problem/A 题意:选择一个黑色格子,将其同一行或者同一列染成黑色,最后询问一个坐标是否可以被染成黑色,需要几次操作。 题解:首先,如果当前格子为黑色,则0次,如果不是黑色,且没有黑色格子,则输出-1,若当前格子的同一行或者同一列有黑色格子,则为1,其他情况为2。 int main() { ios::sync_with_stdio(0); cin.tie(0); cin.tie(0); int t; cin >&g原创 2022-01-16 11:26:12 · 715 阅读 · 2 评论
分享