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 happyness at 2010-08-03 09:57:02 on Problem 2328
#include <stdio.h>
#include <string.h>
main()
{
	int big[11]={11},small[11]={0},i,j,n,re,flag,k=0,m=0;
	char b[100];
	i=j=0;
	while(scanf("%d",&n)!=EOF)
	{
		if(n==0)
		break;
		gets(b);
		if(strcmp(b,"too high")==0)
		{
			big[i]=n;
			i++;
			k=i;
			continue;
		}
		if(strcmp(b,"too low")==0)
		{
			small[j]=n;
			j++;
			m=j;
			continue;
		}
		if(strcmp(b,"right on")==0)
		{
			flag=1;
			re=n;
			for(i=0;i<k;i++)
			{
				if(big[i]<=re)
				{
				  printf("Stan is dishonest\n");
				  flag=0;
				  break;
				}
			}
			for(j=0;(j<m)&&(flag==1);j++)
			{
				if(small[j]>=re)
				{
				  printf("Stan is dishonest\n");
				  flag=0;
				  break;
				}
			}
			if(flag)
			printf("Stan may be honest\n");
		    big[0]=11;
		    small[0]=0;
			i=j=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