POJ 2328

#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;

int main()
{
    //freopen("acm.acm","r",stdin);
    int min;
    int max;
    int tem;
    string s1;
    string s;
    while(1)
    {
        max = 11;
        min = -1;
        
        while(cin>>tem)
        {
            getline(cin,s1);
            getline(cin,s);
            //cout<<s<<endl;
            //cout<<":--------"<<endl;
            if(tem == 0)
                return 0;
            if(s == "too high")
            {
                if(tem < max)
                    max = tem;
            }
            else if(s == "too low")
            {
                if(tem > min)
                    min = tem;
            }
            else if(s == "right on")
            {
                if(tem < max && tem > min)
                {
                    cout<<"Stan may be honest"<<endl;
                    break;
                }
                else
                {
                    cout<<"Stan is dishonest"<<endl;
                    break;
                //    cout<<"00000000000"<<endl;
                }
            }

        }
    }
}
原文地址:https://www.cnblogs.com/gavinsp/p/4568354.html