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 pojwyj at 2012-07-14 10:13:35 on Problem 2328
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){

	int i;
	int n,a[15];
	char hint[10];
	bool flag=1;
	memset(a,-2,sizeof(a));
	while(scanf("%d",&n)!=EOF&&n){

		getchar();
		gets(hint);
		if(strcmp(hint,"too high")==0)
			a[n]=1;
		else if(strcmp(hint,"too low")==0)
			a[n]=-1;
		else if(strcmp(hint,"right on")==0){
			if(a[n]!=-2) {flag=0;printf("Stan is dishonest\n");}
			if(flag){
			a[n]=0;
			for(i=n;i<10;i++)
				if(a[i]==-1) {
					printf("Stan is dishonest\n");
					flag=0;
					break;
				}
			}
			if(flag){
			
			for(i=n;i>=0;i--)
				if(a[i]==1){
					printf("Stan is dishonest\n");
					flag=0;
					break;
				}
			}
			if(flag) printf("Stan may be honest\n");
			memset(a,-2,sizeof(a));
			flag=1;
		}
	}
	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