题目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;
}
#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;
}
相关文章推荐
- 题目1006:ZOJ问题
- 九度 题目1006:ZOJ问题
- 九度oj 题目1006:ZOJ问题 【ZJU2010考研机试题2】【容易理解混乱】
- 题目1006:ZOJ问题
- 题目1006:ZOJ问题
- 题目1006:ZOJ问题
- 九度 oj 题目1006:ZOJ问题
- 题目1006:ZOJ问题
- 题目1006:ZOJ问题(递推规律)
- 题目1006:ZOJ问题
- 九度 题目1006:ZOJ问题
- 九度OJ 题目1006:ZOJ问题
- 【九度】题目1006:ZOJ问题
- 题目1006:ZOJ问题
- 题目1006:ZOJ问题
- 9度oj 题目1006:ZOJ问题【递推】
- ZOJ问题(2010浙江大学研究生复试上机题目[找规律] hdoj 3788)
- 浙大ZOJ 1006 Do the Untwist问题解决及其他人的解决方法
- 1006 ZOJ问题(2010年浙江大学计算机及软件工程研究生机试真题)
- 九度1006:ZOJ问题