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 gdcc11 at 2009-03-23 21:58:08 on Problem 2328
#include<stdio.h>
#include<string.h>
int main()
{
	int n,i=0,j=0,t=0,flag=0;//t用来存储right on的数据,flag用作判断输出
	int h[10]={0},l[10]={0};
        //h[10],l[10]分别用来存储too high和too low的数据
	char s[30]={0};
	while(scanf("%d",&n) != EOF && n!=0 ){

		getchar();
		gets(s);	
		if( !(strcmp(s,"too high")) ){ h[i++]=n; }
		if( !(strcmp(s,"too low")) ){ l[j++]=n; }
		if( !(strcmp(s,"right on")) ){
			t = n;
			while(i){
				i--;
				if(t>=h[i]){flag = 1;}
			}
			while(j){ 
				j--;
				if(t<=l[j]){flag = 1;}
			}
			if(flag==1)
                         { printf("Stan is dishonest\n");flag=0;}
			else{ printf("Stan may be honest\n"); }
		}
	}
	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