您的位置:首页 > 其它

题目1006:ZOJ问题

2013-07-06 00:01 197 查看
谁看懂了告诉我一下啊!看不懂啊!

#include <stdio.h>

#include <string.h>

char s[1001];

int main()

{

int a,b,c;

char *p;

while(scanf("%s",s)!=EOF){

if(!strcmp(s,"zoj")){printf("Accepted\n");continue;} //条件一

a=b=c=0;

p=s;

while(*p=='o'){a++;p++;} //a为第一个z前o的个数

if(*p=='z'){

p++;

while(*p=='o'){b++;p++;} //b为夹在z和j之间的o的个数

if(*p=='j'){

p++;

while(*p=='o'){c++;p++;} //c为j之后的o的个数

if(!(*p) && b>0 && c==a*b){printf("Accepted\n");continue;} //条件三

}

}

printf("Wrong Answer\n");

}

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: