标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3221 Accepted Submission(s): 963
1 #include<stdio.h> 2 #include<string.h> 3 char m[1010]; 4 int judge(){ 5 int t=strlen(m); 6 int x=0,y=0,a=0,b=0,c=0,z=0; 7 for(int i=0;i<t;++i){ 8 if(m[i]==‘z‘)a++; 9 if(m[i]==‘o‘)b++; 10 if(m[i]==‘j‘)c++; 11 //if(m[i]!=‘z‘&&m[i]!=‘o‘&&m[i]!=‘j‘)return 0; 12 } 13 if(a!=1||b==0||c!=1)return 0; 14 a=b=c=0; 15 for(int i=0;i<t;++i){ 16 if(m[i]==‘z‘)a++; 17 if(!a&&m[i]==‘o‘)x++; 18 if(a&&m[i]==‘o‘&&!c)b++; 19 if(a&&b&&m[i]==‘j‘)c++; 20 if(c&&m[i]==‘o‘)z++; 21 }//printf("%d %d %d %d %d\n",a,b,c,x,z); 22 if(a!=1||!b||c!=1)return 0; 23 //if(x==z&&b)return 1; 24 if(z==b*x)return 1; 25 else return 0; 26 } 27 int main() 28 { 29 while(memset(m,0,sizeof(m)),~scanf("%s",m)){ 30 if(judge())puts("Accepted"); 31 else puts("Wrong Answer"); 32 } 33 return 0; 34 }
标签:
原文地址:http://www.cnblogs.com/handsomecui/p/4676255.html