Codeforces #round57.div2
Posted raincle
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces #round57.div2相关的知识,希望对你有一定的参考价值。
A
#include <bits/stdc++.h> using namespace std; int main() { int n,l,r; cin>>n; for (int i=0;i<n;i++){ cin>>l>>r; cout<<l<<" "<<2*l<<endl; } return 0; }
B
#include<bits/stdc++.h> using namespace std; int main() { long long n,beg=0,End=0,cnt=0; cin>>n; char c[n]; for(int i=0;i<n;i++) { cin>>c[i]; } for(int i=1;i<n;i++) { if(c[i]!=c[0]&&beg==0) { beg=i; } else if(c[i]!=c[0]&&beg>0) { End=i; } } if(End==0) End=beg; long long res=beg*(n-End); char q=‘+‘; for(int i=n-1;i>=0;--i) { if(c[i]!=c[0]&&q==‘+‘) { q=c[i]; } else break; } if(q!=‘+‘) { for(int i=n-1;i>=0;--i) { if(c[i]==q) cnt++; else break; } res+=cnt; } else { for(int i=n-1;i>=0;--i) { if(c[i]==c[0]) cnt++; else break; } res+=cnt; } res++; cout<<res%998244353; return 0; }
C
#include<bits/stdc++.h> using namespace std; int chk[185]; int main() { int T; scanf("%d", &T); memset(chk,-1,sizeof chk); for(int i=3;i<=360;i++) { int temp; temp =(180*i-360)/i; if((180*i-360)%i==0) { chk[temp] = i; } if(180%i==0) { for(int j=180/i;j<=temp;j+=180/i) { if(chk[j]==-1) { chk[j]=i; } } } } for(int i=0;i<T;i++) { int ang; scanf("%d",&ang); printf("%d ",chk[ang]); } }
以上是关于Codeforces #round57.div2的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #477 (rated, Div. 2, based on VK Cup 2018 Round 3) C. Stairs and Elevators二分查找(示例(代
Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains 树状数组维护区间最大值(示(代
ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) A Palindromic Supersequence(代
Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A,B,C真的菜·(代
Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) BWeakened Common Diviso(代