Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么是WA??求救!

Posted by wanpi0user at 2005-05-08 13:54:29 on Problem 2328
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator