poj 2328(找规律,n在toolow的最大数和toohigh的最小数之间)

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

 

上一篇:P2921 [USACO08DEC]Trick or Treat on the Farm G


下一篇:【全程NOIP计划】图论算法