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

我不知道还有什么特殊的情况没有考虑到。。。。帮忙。。

Posted by drownever at 2006-12-21 15:48:47 on Problem 2328
#include<iostream.h>
#include<string.h>
#include<stdio.h>
int main()
{
	int a=0,b=11,c,flag=0;
	char s[40];
	cin>>c;
	fflush(stdin);            //读取回车
	while(c!=0)
	{
		gets(s);
		if(c<1||c>10)
		{
			if(c<1&&s[4]=='h'||c>10&&s[4]=='l')
			{
				cout<<"Stan is dishonest"<<endl;
				flag=1;
			}
			//else 继续;;;
		}
		if(flag==1)
			goto lp;           //判断了不诚实后,就等待着right on 的出现。
		if(s[4]=='h')
		{
			if(c<=a+1)
			{
				flag=1;
			}
            else
              if(c<=b)
			b=c;
		}
		if(s[4]=='l')
		{
			if(c>=b-1)
			{
				flag=1;
			}
			else
            if(c>=a)
			  a=c;
		}
lp:
		if(s[4]=='t')
		{
			if(c>a&&c<b&&flag==0)
				cout<<"Stan may be honest"<<endl;
			else
				cout<<"Stan is dishonest"<<endl;
			flag=0;          //碰到一个right on后,初始化,后接着继续判别。
			a=0;b=11;
		}
		cin>>c;
	}
	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