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

刚ac的。这样比直接记位置稍微麻烦一点,思路都比较清楚。特别注意:是may be,而不是一定honest,体会一下

Posted by 20083331 at 2009-04-22 18:45:58 on Problem 2328
#include<iostream>
//#include<stdio.h>
#include<cstring>
using namespace std;

int main()
{
 int record[12]={0};
 char input[2][6]={0};

 int n,i;
 cin>>n;
 while(1)
 {
  if(n==0)
   break;
   cin>>input[0]>>input[1];

  if(strcmp(input[1],"high")==0)
  {
   for(i=n;i<=10;i++) 
    record[i]=1;
  }
  
  else if(strcmp(input[1],"low")==0)
  {
   for(i=1;i<=n;i++)
    record[i]=1;
  }

  else if(strcmp(input[1],"on")==0)
  {
   if(record[n]==0 )
    cout<<"Stan may be honest"<<endl;
   else
    cout<<"Stan is dishonest"<<endl;

   for(int j=1;j<=10;j++)
		record[j]=0;
  }
  else
	  continue;
  cin>>n;
 }
}


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