| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
拜求wa原因……#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
int i;
int n,a[15];
char hint[10];
bool flag=1;
memset(a,-2,sizeof(a));
while(scanf("%d",&n)!=EOF&&n){
getchar();
gets(hint);
if(strcmp(hint,"too high")==0)
a[n]=1;
else if(strcmp(hint,"too low")==0)
a[n]=-1;
else if(strcmp(hint,"right on")==0){
if(a[n]!=-2) {flag=0;printf("Stan is dishonest\n");}
if(flag){
a[n]=0;
for(i=n;i<10;i++)
if(a[i]==-1) {
printf("Stan is dishonest\n");
flag=0;
break;
}
}
if(flag){
for(i=n;i>=0;i--)
if(a[i]==1){
printf("Stan is dishonest\n");
flag=0;
break;
}
}
if(flag) printf("Stan may be honest\n");
memset(a,-2,sizeof(a));
flag=1;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator