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了n次,但还是找不到问题所在,请高手帮忙看看~~~~~

Posted by radish at 2005-03-24 14:31:02 on Problem 2328
#include<iostream.h>
#include<string.h>
#include<stdio.h>
int main()
{
    short a[10],i,m;
    char p[9];
    for(i=0;i<10;i++)a[i]=0;
    while(1)
    {
        cin>>m;fflush(stdin);
        if(m==0)break;
        gets(p);
        if(strcmp(p,"too low")==0)
        {for(i=0;i<m;i++)a[i]=1;}
        if(strcmp(p,"too high")==0)
        {for(i=9;i>=m-1;i--)a[i]=1;}
        if(strcmp(p,"right on")==0)
        {
            if(a[m-1]==0)cout<<"Stan may be honest"<<endl;
            else cout<<"Stan is dishonest"<<endl;
            for(i=0;i<10;i++)a[i]=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