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 WuChengWei at 2008-05-02 22:20:59 on Problem 2328 and last updated at 2008-05-02 22:21:31
#include <stdio.h>
#include <string.h>

int main()
{
    int n, min,max, honest;
    char res[10];

    while( scanf("%d", &n) && n )
    {
        honest = 1, min=1, max=10; // 初始化
        while( scanf("%*s%s", &res) && strcmp(res, "on") )
        {
            if( honest )
            {
                if( strcmp(res, "high")==0 )
                    max = n-1;
                else
                    min = n+1;
                if( max<min || min<1 ||max>10 )
                    honest = 0;
            }
            scanf("%d", &n);
        }
        if( !honest || (n<min) || n>(max))
            printf("Stan is dishonest\n");
        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