摘要: 比赛链接:https://atcoder.jp/contests/abc165/tasks A - We Love Golf 题意 区间 $[a, b]$ 中是否存在 $k$ 的倍数。 代码 #include <bits/stdc++.h> using namespace std; int main 阅读全文
posted @ 2020-05-02 22:31 Kanoon 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1348 A - Phoenix and Balance 题意 将长为偶数的等比数列 $2^1, 2^2, 2^3, ... , 2^n$ 分为两个长为 $\frac{n}{2}$,相差最小的子序列。 题解 原序列可以看做一个二 阅读全文
posted @ 2020-05-02 02:00 Kanoon 阅读(352) 评论(0) 推荐(1) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1342 A - Road To Zero 题意 有两个非负整数 x, y 以及两种操作: 支付 a 点代价使其中一个数加一或减一 支付 b 点代价使两个数都加一或减一 问使二者为 0 的最小代价。 思路 把较大的数减至与较小数 阅读全文
posted @ 2020-04-27 23:45 Kanoon 阅读(170) 评论(2) 推荐(0) 编辑
摘要: 比赛链接:https://atcoder.jp/contests/abc164 A - Sheep and Wolves #include <bits/stdc++.h> using namespace std; int main() { int s, w; cin >> s >> w; cout 阅读全文
posted @ 2020-04-26 22:08 Kanoon 阅读(278) 评论(1) 推荐(2) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1341 A - Nastya and Rice 题意 有 n 堆米,每堆质量在 [a-b,a+b] 之间,这些米的总质量是否可能在 [c-d,c+d] 之间。 思路 n 堆米的最小总质量为 n*(a-b),最大总质量为 n*( 阅读全文
posted @ 2020-04-24 21:18 Kanoon 阅读(263) 评论(0) 推荐(1) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1343 A - Candies 题意 有一数列 x + 2x + 4x + ... + 2k-1x = n,输出 k ≥ 2 时任一满足该等式的一个 x 值。 思路 等比数列求和得 (2k-1) x = n,枚举 k 即可。 阅读全文
posted @ 2020-04-22 01:01 Kanoon 阅读(309) 评论(0) 推荐(2) 编辑
摘要: 比赛链接:https://atcoder.jp/contests/abc163/tasks A - Circle Pond 题意 由半径输出圆周长。 代码 #include <bits/stdc++.h> using namespace std; int main() { double r; cin 阅读全文
posted @ 2020-04-19 23:00 Kanoon 阅读(359) 评论(15) 推荐(3) 编辑
摘要: 比赛链接:https://ac.nowcoder.com/acm/contest/5278 A - 组队比赛 题意 将四个数分为两个和,使二者相差尽量小。 思路 最小数加最大数减去次小数和次大数。 代码 #include <bits/stdc++.h> using namespace std; in 阅读全文
posted @ 2020-04-18 17:06 Kanoon 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1337 A. Ichihime and Triangle 题意 已知 $a,b,c,d$ ,选取 $a≤x≤b≤y≤c≤z≤d$,使得长为 $x,y,z$ 的三边能构成三角形。 思路 $x≤y≤z$,所以若想 $x+y>z$, 阅读全文
posted @ 2020-04-16 12:44 Kanoon 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1335 A. Candies and Two Sisters 题意 把一个数拆成两个不等的数有多少种情况。 思路 奇数时除以二即可,偶数时需要再减去相等的情况。 代码 #include <bits/stdc++.h> usin 阅读全文
posted @ 2020-04-14 01:40 Kanoon 阅读(288) 评论(0) 推荐(0) 编辑