随笔分类 -  刷题笔记: CF

摘要:1418A. Buying Torches 这次A题,真心fo了(导致wa了我两次) 样例出错两次,数据出错一次。 讲一下我的思路吧。 首先先明确至少需要多少个棍。k 个火炬,至少需要ky+k 个棍棍。 其次要想,怎么从1个棍,利用第一条贸易,变成 ky+k 阅读全文
posted @ 2020-09-15 15:22 RioTian 阅读(239) 评论(2) 推荐(1) 编辑
摘要:1406A. Subset Mex https://codeforces.com/contest/1406/problem/A Example input 4 6 0 2 1 5 0 1 3 0 1 2 4 0 2 0 1 6 1 2 3 4 5 6 output 5 3 4 0 Note In t 阅读全文
posted @ 2020-09-13 00:50 RioTian 阅读(402) 评论(3) 推荐(1) 编辑
摘要:题意: 你可以用图示的方法建造金字塔,但是每一次都要建最大的金字塔,问最后能建几个金字塔。 思路: 我们可以发现对于每一个金字塔都是两边增加了两天边,然后中间行数− 1 -1−1个三角形,所以就可以求出每一个金字塔的边数 i=0ki3+2,然后从最大的金字塔开始 阅读全文
posted @ 2020-09-12 20:24 RioTian 阅读(135) 评论(0) 推荐(1) 编辑
摘要:题意: 已知 a1ak ,推导公式见题面。 #include<bits/stdc++.h> using namespace std; typedef long long ll; ll n, k, _, a; int main() { //freopen("in.txt", 阅读全文
posted @ 2020-09-12 19:43 RioTian 阅读(139) 评论(0) 推荐(1) 编辑
摘要:虽然我还是连绿名都没,但还是想学习大牛们的学习方法,加油尽早上分。 转自知乎 之前在 CF 上看到一条不错的评论 https://codeforces.com/blog/entry/66715?#comment-507869,总结其中几点: 多做构造题能有效提高自己的思维,更快地找到切题入口。(构造 阅读全文
posted @ 2020-09-09 21:56 RioTian 阅读(1023) 评论(0) 推荐(0) 编辑
摘要:Problem A - Ahahahahahahahaha https://codeforces.com/contest/1407/problem/A 题意: 给定一个偶数数组(元素值 0,1),在删除一定的数组元素(最多 n/2 个) 以后偶数位和 是否能等于 奇数位和。 在不改变原序 阅读全文
posted @ 2020-09-09 11:00 RioTian 阅读(278) 评论(0) 推荐(1) 编辑
摘要:Codeforces Round #667 (Div. 3) A - D Problem A - Yet Another Two Integers Problem https://codeforces.com/contest/1409/problem/A Example input 6 5 5 13 阅读全文
posted @ 2020-09-06 11:19 RioTian 阅读(327) 评论(1) 推荐(0) 编辑
摘要:Examples input 6 baabbb output bab input 10 ooopppssss output oops 思路: 模拟等差数列即可 #include<bits/stdc++.h> using namespace std; int main() { //freopen("i 阅读全文
posted @ 2020-09-04 21:00 RioTian 阅读(178) 评论(0) 推荐(0) 编辑
摘要:AC代码: #include<bits/stdc++.h> using namespace std; int main() { //freopen("in.txt", "r", stdin); ios_base::sync_with_stdio(false), cin.tie(0), cout.ti 阅读全文
posted @ 2020-09-02 11:03 RioTian 阅读(168) 评论(0) 推荐(0) 编辑
摘要:https://codeforces.com/contest/1397/problem/A 题意: 给定n个字符串,问重新组合以后是否能构成相同的n个字符串 思路: 直接判断所给的字符串的每种字母是否能被n整除即可。 //稍微写复杂了 #include<bits/stdc++.h> #define 阅读全文
posted @ 2020-08-31 09:31 RioTian 阅读(327) 评论(0) 推荐(1) 编辑
摘要:题意: 统计间隔在1中0的个数 思路: 超简单写法,直接利用string的find、rfind函数即可 #include<bits/stdc++.h> using namespace std; int main() { //freopen("in.txt", "r", stdin); ios::sy 阅读全文
posted @ 2020-08-30 21:52 RioTian 阅读(168) 评论(0) 推荐(0) 编辑
摘要:Codeforces 1326A Bad Ugly Numbers 看完题目,第一直觉,质数肯定满足题意,再看数据范畴,1n105, 质数线性筛仅能做到 n=7 的情况,即处理到10000000. 重新读题,发现是一道构造。 当n!=1时,另首位为2,其他均为9即可 #in 阅读全文
posted @ 2020-08-30 20:29 RioTian 阅读(133) 评论(0) 推荐(0) 编辑
摘要:https://codeforces.com/problemset/problem/1288/C Examples input 2 2 output 5 input 10 1 output 55 input 723 9 output 157557417 Note In the first test 阅读全文
posted @ 2020-08-29 21:37 RioTian 阅读(328) 评论(1) 推荐(0) 编辑
摘要:https://codeforces.com/contest/1400/problem/A Example input 4 1 1 3 00000 4 1110000 2 101 output 1 000 1010 00 **思路:**先贴下代码,有事要去医院,等会补上思路。 AC代码: #incl 阅读全文
posted @ 2020-08-26 12:17 RioTian 阅读(266) 评论(0) 推荐(0) 编辑
摘要:AC代码: #include<bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; if (n <= 30) cout << "no" << endl; else { if (n != 36 && n != 40 && 阅读全文
posted @ 2020-08-25 20:59 RioTian 阅读(212) 评论(0) 推荐(0) 编辑
摘要:题目连接:Codeforces 451B Sort the Array 题目大意:给出一个长度为n的序列,可以有一次机会旋转a[l]到a[r]之间的数,问说可否形成一个递增序列。 解题思路:将数组排下序,然后从前向后,从后向前寻找不同到位置,这段l~r是一定要旋转的,然后判断旋转后的符不符合递增。注 阅读全文
posted @ 2020-08-24 09:40 RioTian 阅读(261) 评论(0) 推荐(0) 编辑
摘要:题意: 给你每个人的上级,并且一个人和他的所有上级都不能在一个party(小组)中(这点是根据题目给出的两点推导出来的),问最少需要几个party。 思路: 并查集,找一个集合中层级数最多的就是最少需要的party数量。 #include<bits/stdc++.h> using namespace 阅读全文
posted @ 2020-08-23 11:02 RioTian 阅读(148) 评论(0) 推荐(0) 编辑
摘要:成功拼手速提前过了AC两题,估计因为这个原因排名挺高的,B题晚上做的时候没绕出来,wa4发。。。 1401A - Distance and Axis 如果 n 小 于 k ,则必须将A移至坐标k,并将B的坐标设置为0或k。 因此答案是kn。 如果 n不小于 \( 阅读全文
posted @ 2020-08-22 10:15 RioTian 阅读(303) 评论(0) 推荐(0) 编辑
摘要:A: CodeForces - 1300A Input 1 1 1 Output 0 思路: 循环遍历输入,如果读入0,cnt++,sum++,如果这样sum == 0,cnt++即可 写的时候莫名写错,搞得WA2发 #include<bits/stdc++.h> using namespace s 阅读全文
posted @ 2020-08-21 20:36 RioTian 阅读(185) 评论(1) 推荐(0) 编辑
摘要:A:Codeforces 1328A Divisibility Problem 整除+模 Input 5 10 4 13 9 100 13 123 456 92 46 Output 2 5 4 333 0 按需取余,和我之前发的文章一样的解法 ll a, b; void solve() { cin 阅读全文
posted @ 2020-08-19 15:13 RioTian 阅读(129) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示