| ||||||||||
| 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 | |||||||||
Re:哪位帮我看下哪里有错In Reply To:哪位帮我看下哪里有错 Posted by:happyness at 2010-08-03 09:57:02 #include<stdio.h>
#include<string.h>
int main()
{
int big[11]={10},small[11]={0};
int i=0,j=0,k=0,m=0,n,count;
int flag;
char b[50];
while(scanf("%d",&n)!=EOF)
{
if(n==0)
break;
gets(b);
if(strcmp(b,"too low")==0)
{
small[i]=n;
i++;
k=i;
continue;
}
if(strcmp(b,"too high")==0)
{
big[j]=n;
j++;
m=j;
continue;
}
if(strcmp(b,"right on")==0)
{
count=n;
flag=1;
for(j=0;j<m;j++)
{
if(big[j]<=count)
{
printf("Stan is dishonest\n");
flag=0;
break;
}
}
for(i=0;(i<k)&&(flag==1);i++)
{
if(small[i]>=count)
{
printf("Stan is dishonest\n");
flag=0;
break;
}
}
if(flag)
printf("Stan may be honest\n");
big[0]=0;
small[0]=0;
i=0;
j=0;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator