Codeforces Beta Round #61 (Div. 2)
A
输入用long double
1 #include2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define rep(k,i,j) for(int k=i;k >n;20 if(n>=-128&&n<=127) cout<<"byte"< =-32768&&n<=32767) cout<<"short"< =-2147483648&&n<=2147483647) cout<<"int"<
B
暴力枚举每一个数即可
1 #include2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define rep(k,i,j) for(int k=i;k >n;22 for(int i=1;i<=n;i++){23 cin>>a[i];24 }25 int ans=1;26 for(int i=1;i<=n;i++){27 int j=i-1;28 int co=1;29 while(j>=1){30 if(a[j+1]>=a[j]){31 j--;32 co++;33 }34 else{35 break;36 }37 }38 j=i+1;39 while(j<=n){40 if(a[j-1]>=a[j]){41 j++;42 co++;43 }44 else{45 break;46 }47 }48 if(co>ans) ans=co;49 }50 cout< <
C
模拟题
1 #include2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define rep(k,i,j) for(int k=i;k M,N;16 17 int main(){18 #ifndef ONLINE_JUDGE19 freopen("input.txt","r",stdin);20 #endif21 std::ios::sync_with_stdio(false);22 while(cin>>t)23 {24 s=t;25 int F=0;26 while(1)27 {28 int x=s.find_last_of('\\');29 if (x==2) break;30 s=s.substr(0,x);31 int f=N[s];32 M[s]+=F;33 N[s]++;34 res1=max(res1,M[s]);35 res2=max(res2,N[s]);36 if (!f) F++;37 }38 }39 cout< <<' '< <
D
找出3个数,使他们两两的公约数互不为1,他们三个的公约数为1,剩下的数就输出他们的倍数即可
1 #include2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define rep(k,i,j) for(int k=i;k >n;22 if(n==2){23 cout<<-1<
E
找出a[i]-b[i]前缀和的最小值,然后依次减去,如果发现minn大于等于0的情况,说明走的通,逆向同理
1 #include2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000006 9 #define rep(k,i,j) for(int k=i;k