| ||||||||||
| 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 | |||||||||
无赖了!A waste of time!WA!In Reply To:能测的数据都测了,就是WA,疯了 Posted by:wyu_feng at 2008-10-12 01:50:44 #include <iostream>
using namespace std;
char gg[100];
int low,high,guess;
int func()
{
if(strcmp(gg,"too high")==0)return 1;
else if(strcmp(gg,"too low")==0)return -1;
else return 0;
}
int main()
{
bool flag;
while(1)
{
low=1;
high=10;
flag=true;
while(1)
{
cin>>guess;
if(guess==0)return 0;
cin.get();
cin.getline(gg,99);
if(func()==0)
{
if(guess<low||high<guess)flag=false;
if(flag)cout<<"Stan may be honest\n";
else cout<<"Stan is dishonest\n";
break;
}
else if(func()==1)high=guess-1;
else low=guess+1;
if(low>high)flag=false;
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator