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了2个小时了!WAWA!In Reply To:无赖了!A waste of time!WA! Posted by:cycpp at 2008-11-21 23:07:10 > #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