标签:style blog http color os io ar for 2014
The Himalayas http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5341
签到
1 #include<cstdio> 2 int main(){ 3 int t,n,a[64]; 4 while(~scanf("%d",&t)){ 5 while(t--){ 6 scanf("%d",&n); 7 for(int i=1;i<=n;i++){ 8 scanf("%d",&a[i]); 9 } 10 int ans=0; 11 for(int i=2;i<n;i++){ 12 if(a[i]>a[i-1]&&a[i]>a[i+1]){ 13 ans++; 14 } 15 } 16 printf("%d\n",ans); 17 } 18 } 19 return 0; 20 }
Pretty Poem http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5350
string
1 #include<cstdio> 2 #include<cctype> 3 #include<iostream> 4 using namespace std; 5 char sin[64],sout[64]; 6 string a1,a2,a3,b1,b2,b3,c; 7 int main(){ 8 int t; 9 scanf("%d",&t); 10 while(t--){ 11 scanf("%s",sin); 12 int ls=0; 13 for(int i=0;sin[i];i++){ 14 if(isalpha(sin[i])){ 15 sout[ls++]=sin[i]; 16 } 17 } 18 bool flag=false; 19 for(int la=1;la<=ls;la++){ 20 for(int lb=1;lb<=ls;lb++){ 21 if(la*3+lb*2==ls){///"ABABA" 22 a1=a2=a3=b1=b2=""; 23 int s=0; 24 for(int i=0;i<la;i++){ 25 a1+=sout[s+i]; 26 } 27 s+=la; 28 for(int i=0;i<lb;i++){ 29 b1+=sout[s+i]; 30 } 31 s+=lb; 32 for(int i=0;i<la;i++){ 33 a2+=sout[s+i]; 34 } 35 s+=la; 36 for(int i=0;i<lb;i++){ 37 b2+=sout[s+i]; 38 } 39 s+=lb; 40 for(int i=0;i<la;i++){ 41 a3+=sout[s+i]; 42 } 43 s+=lb; 44 if(a1==a2&&a1==a3&&b1==b2&&a1!=b1){ 45 flag=true; 46 break; 47 } 48 } 49 if(la*3+lb*3<ls){///"ABABCAB" 50 a1=a2=a3=b1=b2=b3=c=""; 51 int s=0; 52 for(int i=0;i<la;i++){ 53 a1+=sout[s+i]; 54 } 55 s+=la; 56 for(int i=0;i<lb;i++){ 57 b1+=sout[s+i]; 58 } 59 s+=lb; 60 for(int i=0;i<la;i++){ 61 a2+=sout[s+i]; 62 } 63 s+=la; 64 for(int i=0;i<lb;i++){ 65 b2+=sout[s+i]; 66 } 67 s+=lb; 68 int lc=ls-3*la-3*lb; 69 for(int i=0;i<lc;i++){ 70 c+=sout[s+i]; 71 } 72 s+=lc; 73 for(int i=0;i<la;i++){ 74 a3+=sout[s+i]; 75 } 76 s+=la; 77 for(int i=0;i<lb;i++){ 78 b3+=sout[s+i]; 79 } 80 s+=lb; 81 if(a1==a2&&a1==a3&&b1==b2&&b1==b3&&a1!=b1&&a1!=c&&b1!=c){ 82 flag=true; 83 break; 84 } 85 } 86 } 87 if(flag) break; 88 } 89 if(flag) puts("Yes"); 90 else puts("No"); 91 } 92 return 0; 93 }
end
The 2014 ACM-ICPC Asia Mudanjiang Regional First Round
标签:style blog http color os io ar for 2014
原文地址:http://www.cnblogs.com/gaolzzxin/p/3960727.html