poj 2328(水题,注意审题)

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
    int p;
    char a[10];
    int s=0,e=11;
    while(true){
        scanf("%d",&p);
        if(p==0)break;
        gets(a);
        if(!strcmp(a,"right on")){
            if(s<e&&p>s&&p<e)
                printf("Stan may be honest\n");
            else
                printf("Stan is dishonest\n");
            s = 0;
            e = 11;
        }
        else if(!strcmp(a,"too high"))
            e = min(e,p);
        else if(!strcmp(a,"too low"))
            s = max(s,p);
    }
    return 0;
}

 

posted @ 2021-07-31 15:43  智人心  阅读(37)  评论(0)    收藏  举报