| ||||||||||
| 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 | |||||||||
为什么错了啊,我郁闷,求救啊#include <stdio.h>
#include <string.h>
#include <iostream.h>
char s[100];
int n;
int main()
{
while(cin>>n && n!=0)
{
int a=1;
int b=10;
int flag=1;
while(1)
{
gets(s);
if(strcmp(s,"right on")==0)
{
if(a>b||a>n||b<n)
flag=0;
break;
}
if(flag==1)
{
if(strcmp(s,"too high")==0&&n<=b)
{
b=n-1;
}
else
if(strcmp(s,"too low")==0&&n>=a)
{
a=n+1;
}
if(a>b)flag=0;
}
cin>>n;
}
if(flag==1)
printf("Stan may be honest\n");
else
printf("Stan is dishonest\n");
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator