随笔分类 -  codeforces总结

摘要:A. Sum of Odd Integers 首先可以算出从1开始到第k个奇数之和。如果和大于n,则不可能存在k个奇数加和等于n,否则用n减去前k个奇数的和,这个差值若是偶数,直接加到最大的奇数上,就可以满足题意要求,否则输出no。 1 #include<bits/stdc++.h> 2 using 阅读全文
posted @ 2020-03-26 00:48 AaronChang 阅读(247) 评论(0) 推荐(1)
摘要:https://codeforces.com/contest/1324 D. Pair of Topics ai + aj > bi + bj 移项 ai - bi + aj - bj > 0 ,输入a数组和b数组后,做减法构造一个c数组为ai - bi,c数组排序一下,二分找ci - cj 大于0 阅读全文
posted @ 2020-03-19 16:56 AaronChang 阅读(194) 评论(0) 推荐(1)
摘要:https://codeforces.com/contest/1323 A. Even Subset Sum Problem. 数据范围只有100,两个for暴力枚举一遍,记录满足题意的区间左右端点即可。最后输出。 1 #include<bits/stdc++.h> 2 using namespac 阅读全文
posted @ 2020-03-09 11:56 AaronChang 阅读(257) 评论(0) 推荐(0)
摘要:A. Two Rabbits (手速题) 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 int main(){ 5 int t; 6 cin>>t; 7 while(t--){ 8 ll x,y, 阅读全文
posted @ 2020-02-24 17:24 AaronChang 阅读(129) 评论(0) 推荐(0)
摘要:A. Erasing Zeroes (模拟) 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 1e5+5; 5 int main(){ 6 int t;cin>>t 阅读全文
posted @ 2020-02-24 17:18 AaronChang 阅读(110) 评论(0) 推荐(0)
摘要:链接:https://codeforces.com/contest/1295 A. Display The Number 贪心思路,尽可能放置更多位,如果n为奇数,消耗3去放置一个7,剩下的放1 AC代码: 1 #include<bits/stdc++.h> 2 #define inf 0x3f3f 阅读全文
posted @ 2020-02-02 19:40 AaronChang 阅读(165) 评论(0) 推荐(0)
摘要:contest链接:https://codeforces.com/contest/1294 A. 给出a、b、c三个数,从n中分配给a、b、c,问能否使得a = b = c。计算a,b,c三个数的差值之和,n对其取余,判断是否为0即可。 AC代码: 1 #include<iostream> 2 #i 阅读全文
posted @ 2020-01-28 00:34 AaronChang 阅读(225) 评论(0) 推荐(0)
摘要:链接:https://codeforces.com/contest/1293 A. ConneR and the A.R.C. Markland-N 题意:略 思路:上下枚举1000次扫一遍,比较一下上下最近的房间 AC代码: 1 #include<iostream> 2 #include<cstd 阅读全文
posted @ 2020-01-25 16:41 AaronChang 阅读(170) 评论(0) 推荐(0)
摘要:contest链接:https://codeforces.com/contest/1288 A. Deadline 题意:略 思路:根据题意 x + [d/(x+1)] 需要找到一个x使得上式小于等于n,即x + [d/(x+1) ] <=n,不等式两边同时+1得 x+1 + [d/(x+1)] < 阅读全文
posted @ 2020-01-19 01:18 AaronChang 阅读(186) 评论(0) 推荐(0)
摘要:contest链接:https://codeforces.com/contest/1285 A. Mezo Playing Zoma 签到 1 #include<iostream> 2 #include<vector> 3 #include<cstdio> 4 #include<algorithm> 阅读全文
posted @ 2020-01-14 14:30 AaronChang 阅读(188) 评论(0) 推荐(0)
摘要:contest链接:https://codeforces.com/contest/1284 A. New Year and Naming 思路:签到,字符串存一下,取余拼接。 1 #include<iostream> 2 #include<vector> 3 #include<cstring> 4 阅读全文
posted @ 2020-01-13 01:01 AaronChang 阅读(267) 评论(0) 推荐(1)
摘要:contest链接:https://codeforces.com/contest/1269 A. Equation 题意:输入一个整数,找到一个a,一个b,使得a-b=n,切a,b都是合数 思路:合数非常多,从1开始枚举b,a就是b+n,每次check一下a,b是否是合数,是的话直接输出,break 阅读全文
posted @ 2020-01-03 23:37 AaronChang 阅读(270) 评论(0) 推荐(0)
摘要:contest链接: https://codeforces.com/contest/1282 A. Temporarily unavailable 题意: 给一个区间L,R通有网络,有个点x,在x+r和x-r范围内,没有网络,问在这个区间上有网络的长度范围 思路:枚举区间覆盖情况,注意细节 AC代码 阅读全文
posted @ 2020-01-01 21:30 AaronChang 阅读(230) 评论(0) 推荐(0)
摘要:contest链接:https://codeforces.com/contest/1283 A. Minutes Before the New Year 题意:给一个当前时间,输出离第二天差多少分钟 思路:略 AC代码: 1 #include<iostream> 2 #include<vector> 阅读全文
posted @ 2020-01-01 20:44 AaronChang 阅读(288) 评论(0) 推荐(2)