随笔分类 - codeforces
摘要:Codeforces Round #690 (Div. 3) A #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef long long ll; typedef unsigned long long
阅读全文
摘要:Educational Codeforces Round 100 (Rated for Div. 2) A #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef long long ll; typed
阅读全文
摘要:Codeforces 414-B. Mashmokh and ACM 传送门 是一道数位dp,我还是dp太菜了,多做题吧,具体的写在code里面了 #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef
阅读全文
摘要:传送门 还是比较明显的线段树的操作 #include <bits/stdc++.h> using namespace std; const int N = 2e6 + 10; int a[N]; int tn, m, n; struct stree { int id, num; } tree[N <
阅读全文
摘要:Educational Codeforces Round 96 (Rated for Div. 2) A-Number of Apartments #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef
阅读全文
摘要:B. Brexit Negotiations 得反向建图,正向建图,使用优先队列,在权值相同的情况下,不同的选择会对后续的结果产生影响,而反向建图,从结果出发则可以避免这个影响。 以后得习惯逆向思维,反向建图会解决很多问题 #include<bits/stdc++.h> using namespac
阅读全文
摘要:Baby name #include<bits/stdc++.h> using namespace std; string a, b; string solve(string x) { int len = x.size(); string t1, t2; // t1 += x[0]; for (in
阅读全文
摘要:Codeforces Round #665 (Div. 2) 题解 A. Distance and Axis \[ \begin{cases} x+y=n\\ x-y=k\\ \end{cases}\\ \Rightarrow \begin{cases} x=\tfrac{n+k}{2}\\ y=\
阅读全文
摘要:Educational Codeforces Round 93 (Rated for Div. 2) 题解 A. Bad Triangle 排序之后只用看第一个 第二个 和最后一个元素是否满足条件即可 #include<bits/stdc++.h> using namespace std; #pra
阅读全文
摘要:Codeforces Round #662 (Div. 2) 题解 A. Rainbow Dash, Fluttershy and Chess Coloring 阅读题,题意比较难理解,但是读懂题多画几个例子之后就能发现答案其实就是 ans=n/2+1; #include<bits/stdc++.h
阅读全文
摘要:Codeforces Round #661 (Div. 3) Remove Smallest #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef long long ll; typedef unsi
阅读全文
摘要:CF-474D 很多人说是个dp,但其实更多的应该和数学递推关系更大,其实和紫书上的fibonacci数列的递推方法一样 我们先假设k=2,len=5时: 5=1+1+1+1+1(RRRRR) 5=2+1+1+1(WWRRR) 5=1+2+1+1(RWWRRR) 5=1+1+2+1(RRWWR) 5
阅读全文
摘要:A.Required Remainder 传送门 #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef long long ll; typedef unsigned long long ull; ty
阅读全文
摘要:A. Donut Shops 题目传送门 水题,就用a * b和c比一下大小就行了,要求买第一种饼干便宜的情况就假设只买一块,比较a和c的大小,求买第二种便宜就比较 a * b和c比大小就行了 #include<bits/stdc++.h> using namespace std; #pragma
阅读全文
摘要:A. Maximum GCD 题目链接 水题,n/2向下取整一定能得到最大的gcd,在此就不证明了(太菜了,不怎么会证,太菜了太菜了。 #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+10; int t, n; in
阅读全文
摘要:A. C+= 题目链接 水题,就每一次用小的加大的,保留大的就行了 具体看代码叭 #include<bits/stdc++.h> using namespace std; int t,a,b,n; int main() { ios::sync_with_stdio(false); cin>>t; w
阅读全文
摘要:Codeforces Round #595 (Div. 3) C-Good Numbers (hard version) 题面 easy version 就不多做赘述了,预处理也行,直接做hard version更好 题意:如果正整数可以表示为3的不同幂的总和(即不允许重复使用3的幂),则将其称为好
阅读全文
摘要:B. Bogosort 水题,把数组降序排列输出就行了 #include<bits/stdc++.h> using namespace std; const int maxn=101; int a[maxn]; int main() { int t; scanf("%d",&t); while(t-
阅读全文

浙公网安备 33010602011771号