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

参考了无数版本,就是自己的不能AC,郁闷~~请问哪位能指点迷津

Posted by Kimers at 2005-04-23 16:23:34 on Problem 2328
#include <iostream.h>

void main()
{
	int n;
	int high,low;//high为最高可取的值。low同理
	char A[10];
	int check;
	while(1)
	{
		check = 1;
		high = 10;
		low = 1;

		cin>>n;
		if(n == 0) break;
		cin>>A;
		cin>>A;//保证A取第二位的首字母;若不为就跳过
		if(A[0] == 'h' && n <= high) high = n - 1;
		if(A[0] == 'l' && n >= low) low = n + 1;
		
		if(A[0] != 'o')
			while(1)
			{
				cin>>n>>A;
				cin>>A;
				if(A[0] == 'h' && n <= high) high = n - 1;
				if(A[0] == 'l' && n >= low) low = n + 1;
				if(high < low) check = 0;
				
				if(A[0] == 'o') break;
			}
		
		if(low > high) check = 0;
		if(check == 1) cout<<"Stan may be honest"<<endl;
		else cout<<"Stan is dishonest"<<endl;
	}
}

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