![](https://img-blog.csdnimg.cn/4fcbbe4a27704ae6aa3375fa92146130.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
codeforces
acmer--fengzlj选手的cf刷题笔记
fengzlj
向wjmzbmr大神看齐,ACM本就是逆天而行
展开
-
Codeforces Round #558 (Div. 2)
A # include <bits/stdc++.h> using namespace std; int main() { int n,m; int c; scanf("%d %d",&n,&m); if(m==0){ printf("1"); }else{ c=n-m; printf("%d",min(c,m)); } return 0; } B # include <bits/stdc++.h> using name原创 2022-02-26 21:31:19 · 134 阅读 · 0 评论 -
Educational Codeforces Round 64 (Rated for Div. 2)
A # include <bits/stdc++.h> using namespace std; typedef long long LL; int a[110]; LL sum=0; int main() { int n; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&a[i]); } for(int i=1;i<n;i++){ if(a[i-1]==1){ if(a[i]==2){原创 2022-02-26 21:29:50 · 80 阅读 · 0 评论 -
Codeforces Round #556 (Div. 2)
A # include <bits/stdc++.h> using namespace std; typedef long long LL; LL s[40]; LL b[40]; bool cmp(LL a,LL b) { return a>b; } int main() { LL n,m,r; LL aa,bb; scanf("%lld %lld %lld",&n,&m,&r); for(int i=0;i<n;i++){ scanf("%原创 2022-02-26 21:27:33 · 87 阅读 · 0 评论 -
Codeforces Round #555 (Div. 3)
A # include <bits/stdc++.h> using namespace std; typedef long long LL; int f[10]; int main() { LL n; LL sum=0; scanf("%lld",&n); LL nn=n; LL ans=0; while(1){ LL m=nn/10*10+9; LL mm=m; LL d=0; while(mm){ d++; mm=mm/10; }原创 2022-02-26 21:26:00 · 60 阅读 · 0 评论 -
Codeforces Round #554 (Div. 2)
A # include <bits/stdc++.h> using namespace std; typedef long long LL; const LL MAXN=1e5+10; LL a[MAXN]; LL b[MAXN]; int main() { LL n,m; LL ao=0,ae=0,bo=0,be=0; LL sum=0; scanf("%lld %lld",&n,&m); for(LL i=0;i<n;i++){ scanf("%l原创 2022-02-26 21:23:17 · 61 阅读 · 0 评论 -
Educational Codeforces Round 63 (Rated for Div. 2)
A # include <bits/stdc++.h> using namespace std; int main() { int n; int flag=1; string a; scanf("%d",&n); cin>>a; for(int i=1;i<n;i++){ if(a[i]<a[i-1]){ flag=0; printf("YES\n"); printf("%d %d",i,i+1); break原创 2022-02-26 21:21:29 · 43 阅读 · 0 评论 -
Codeforces Round #553 (Div. 2)
A # include <bits/stdc++.h> using namespace std; const int INF=1e9; int f[55]; int main() { int n; int len=INF; string s; char b[4]={'A','C','T','G'}; cin>>n; cin>>s; for(int j=0;j<n;j++){ int l=0,d=0; if((j+3)<n){原创 2022-02-26 21:18:33 · 70 阅读 · 0 评论 -
Codeforces Round #552 (Div. 3)
A # include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { LL x[5]; LL a,b,c; scanf("%lld %lld %lld %lld",&x[0],&x[1],&x[2],&x[3]); sort(x,x+4); a=x[3]-x[0]; b=x[3]-x[1]; c=x[3]-x[2]; printf原创 2022-02-26 21:16:03 · 49 阅读 · 0 评论 -
Codeforces Global Round 2
A # include <bits/stdc++.h> using namespace std; pair<int,int> b[300100]; pair<int,int> e[300100]; int main() { int n; int a; cin>>n; for(int i=1;i<=n;i++){ b[i].first=0,e[i].first=0; b[i].second=i,e[i].second=i; } f原创 2022-02-26 21:13:17 · 75 阅读 · 0 评论 -
Codeforces Round #550 (Div. 3)
A # include <bits/stdc++.h> using namespace std; int main() { int n,flag=1,minn=27,maxx=0; string a; int f[30]; cin>>n; memset(f,0,sizeof(f)); for(int i=0;i<n;i++){ cin>>a; if(a.length()==1){ cout<<"Yes"<<en原创 2022-02-26 21:10:38 · 76 阅读 · 0 评论 -
Educational Codeforces Round 69 (Rated for Div. 2)
A. DIY Wooden Ladder 签到题,比较现在能够有的阶梯数和规定的阶梯数就可以了 # include <bits/stdc++.h> using namespace std; const int MAXN=1e5+100; int a[MAXN]; int cmp(int a,int b) { retu...原创 2019-07-24 02:27:14 · 60 阅读 · 0 评论 -
Codeforces Round #575 (Div. 3)
是真的蠢啊,在AB两题签到题卡了一个小时,QAQ A. Three Piles of Candies 签到题,其实把三个加起来除以二就可以了 # include<bits/stdc++.h> using namespace std; typedef long long LL; int main() { int q; scanf("%d",&q); while(q--){...原创 2019-07-26 02:02:45 · 90 阅读 · 0 评论 -
Educational Codeforces Round 64 (Rated for Div. 2)
A. Inscribed Figures 题意:就是1 2 3分别代表 圆 等腰三角形 正方形,然后往每一个图形里面套下一个图形,求最后的相交点总共有多少个(题意还是有点难懂的,(我不会说是他题目一开始改来改去的我有点懵逼),其实是我菜吧。。。) 分析: # include <bits/stdc++.h> using namespace std; typedef long lon...原创 2019-05-03 21:52:49 · 111 阅读 · 0 评论 -
Codeforces Round #555 (Div. 3)
A. Reachable Numbers 可以发现一个规律,就是到达一个数直到那个数的最后一位为0,数的位数才会变。而且还有一个坑点就是一位数,到达一个数,那么一位数的所有数都可以到达 # include <bits/stdc++.h> using namespace std; typedef long long LL; int f[10]; int main() { LL n; ...原创 2019-04-29 21:18:08 · 105 阅读 · 0 评论 -
Codeforces Round #554 (Div. 2)
A. Neko Finds Grapes A就是钥匙和锁上的数字的和为奇数就行。 odd+even=odd odd+odd=even even+even=even 所以只要保证奇数和偶数加就行,就是用奇数的锁去配对偶数的钥匙,偶数的锁去配对奇数的钥匙 # include <bits/stdc++.h> using namespace std; typedef long long LL...原创 2019-07-08 10:05:24 · 86 阅读 · 0 评论 -
Educational Codeforces Round 63 (Rated for Div. 2)
A. Reverse a Substring 就是反转一部分字符串,然后让字符串按照字典序变小,那么只要有一块时降序就可以了 # include <bits/stdc++.h> using namespace std; int main() { int n; int flag=1; string a; scanf("%d",&n); cin>>a...原创 2019-07-08 10:04:45 · 60 阅读 · 0 评论 -
Codeforces Round #558 (Div. 2)(不完整版)
分类讨论场,做完签到感觉就和我没什么关系了,日后补题 A Eating Soup 就是判断是否可以每个一组,是按照分隔计数的符合现实,还是按照剩余计数的符合现实。当然还有特判的,就是是否是没有分割的 # include <bits/stdc++.h> using namespace std; int main() { int n,m; int c; scanf("%d...原创 2019-05-10 23:19:48 · 115 阅读 · 0 评论 -
Educational Codeforces Round 67 (Rated for Div. 2)
A - Stickers and Toys 题目大意就是有n个鸡蛋,然后有s个彩带(吧?忘记了)和t个玩具,问至少要拿几次鸡蛋才有可能拿到一个彩带和一个鸡蛋。 就是可以分成三部分来算,就是a表示只有彩带的鸡蛋,b表示只有玩具的鸡蛋,c表示既有彩带又有玩具的鸡蛋。然后在a,b中取最大然后再+1就可以。 # include <bits/stdc++.h> using n...原创 2019-07-08 14:16:53 · 91 阅读 · 0 评论 -
Codeforces Round #571 (Div. 2)
A. Vus the Cossack and a Contest 签到题,比较一下m,k只要之中小的大于等于n就可以 # include <bits/stdc++.h> using namespace std; int main() { int n,m,k; cin>>n>>m>>k; int minn; mi...原创 2019-07-09 17:04:56 · 74 阅读 · 0 评论 -
Educational Codeforces Round 68 (Rated for Div. 2)
A. Remove a Progression 签到题,观察可得规律,每次删除的是奇数,所以只要把x*2输出即可,因为输出第几个偶数 # include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { int T; sc...原创 2019-07-15 02:17:19 · 56 阅读 · 0 评论 -
Codeforces Round #570 (Div. 3)
A. Nearest Interesting Number 就是要求离所给的数最近的所有位数的和能被4整除的数,那么直接从所给的数开始,然后一个一个求就可以了,复杂度不高,不会T; # include <bits/stdc++.h> using namespace std; int main() { int a; scanf("%d",&a); f...原创 2019-07-10 19:02:42 · 60 阅读 · 0 评论 -
Codeforces Round #574 (Div. 2)
A. Drinks Choosing 签到题,就是对每一种饮料都可以拿好多次,在拿饮料总和有限的条件下,问最多能够满足多少人 # include <bits/stdc++.h> using namespace std; const int MAXN=1e3+100; int a[MAXN]; int main() { ...原创 2019-07-19 21:00:14 · 96 阅读 · 0 评论 -
Codeforces Round #556 (Div. 2)
A. Stock Arbitraging 签到题,买股票,就是买的价格分别为si,卖的价格分别为bi,用最少的钱买进,用最大的价格卖出,还有别忘记加上买股票是剩下的钱 # include <bits/stdc++.h> using namespace std; typedef long long LL; LL s[40]; LL b[40]; bool cmp(LL a,LL b) ...原创 2019-05-03 20:28:25 · 198 阅读 · 0 评论