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 wocha at 2012-03-31 22:01:51
#include<stdio.h>
#include<string.h>
int main()
{
//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int q,w,e,r,i,j,n,m[100];
	char str[23];
	for(i=1;i<=10;i++)
	m[i]=i;
	while(scanf("%d",&q)&&q!=0)
	{
		getchar();
		gets(str);
		if(strcmp(str,"too high")==0)
		{
			for(i=q;i<=10;i++)
			m[i]=0;
		}
		if(strcmp(str,"too low")==0)
		{
      for(i=q;i>=1;i--)
		  	m[i]=0;
		}
		if(strcmp(str,"right on")==0)
		{
	   r=0;
			for(i=1;i<=10;i++)
	  	if(m[q]!=0) {r++;break;}
    	if(r==0)
			  printf("Stan is dishonest\n");
	    if(r==1)
			  printf("Stan may be honest\n");
      for(i=1;i<=10;i++)
     	m[i]=i;
		}
}
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