| ||||||||||
| 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:加if(max<num) false,if(min>num)falseIn Reply To:为什么是WA??求救! Posted by:wanpi0user at 2005-05-08 13:54:29 > #include<string>
> #include<cstdio>
> #include<iostream>
> using namespace std;
> int main(){
> int num=1;
> bool honest=true;
> string str;
> int max=10,min=1;
> while(1){
> cin>>num;
> if(num==0) break;
> cin>>str>>str;
> if(str=="high"){
> max=max>num?num-1:max;
> if(min>max) honest=false;
> cout<<"max="<<max<<endl;
> }
> else if(str=="low"){
> min=min>num?min:num+1;
> if(min>max) honest=false;
> cout<<"min="<<min<<endl;
> }
> else if(str=="on"){
> if(num<min||num>max)honest=false;
> if(honest) cout<<"Stan may be honest";
> else cout<<"Stan is dishonest";
> cout<<endl;
> max=10;min=1;honest=true;
> }
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator