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

Re:哪位帮我看下哪里有错

Posted by 1108060046 at 2012-07-19 08:41:51 on Problem 2328
In Reply To:哪位帮我看下哪里有错 Posted by:happyness at 2010-08-03 09:57:02
#include<stdio.h>
#include<string.h>
int main()
{
	int big[11]={10},small[11]={0};
	int i=0,j=0,k=0,m=0,n,count;
	int flag;
	char b[50];
	while(scanf("%d",&n)!=EOF)
	{
		if(n==0)
			break;
		gets(b);
		if(strcmp(b,"too low")==0)
		{
			small[i]=n;
			i++;
			k=i;
			continue;
		}
		if(strcmp(b,"too high")==0)
		{
		    big[j]=n;                                        
			j++;
			m=j;
			continue;
		}
		if(strcmp(b,"right on")==0)
		{
             count=n;
			 flag=1;
		
		   for(j=0;j<m;j++)
		   {
			   if(big[j]<=count)
			   {
			printf("Stan is dishonest\n");
			   flag=0;
			   break;
			   }
		   }
		   for(i=0;(i<k)&&(flag==1);i++)
		   {
			   if(small[i]>=count)
			   {
               printf("Stan is dishonest\n");
			   flag=0;
			   break;
			   }
		   }
		   if(flag)
		   
            printf("Stan may be honest\n");
		    big[0]=0;
		   small[0]=0;
		   i=0;
		   j=0;
		}
	}
		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