UVa : 10530


// @BEGIN_OF_SOURCE_CODE

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#define For(a) for ( i = 0; i < a; i++ )
#define Rep(a, b) for ( i = a; i <= b; i++ )
#define N 1000000
using namespace std;


int main ()
{
    int guess;
    char ans1 [10];
    char ans2 [10];

    while ( scanf ("%d", &guess) && guess ) {

        int high = 11;
        int low = 0;

        while ( scanf ("%s %s", ans1, ans2) && strcmp (ans1, "right") != 0 ) {
            if ( strcmp (ans2, "high") == 0 ) {
                if ( guess <= high )
                    high = guess - 1;
            }

            else if ( strcmp (ans2, "low") == 0 ) {
                if ( guess >= low )
                    low = guess + 1;
            }
            scanf ("%d", &guess);
        }

        if ( guess < low || guess > high || low > high )
            printf ("Stan is dishonest\n");
        else
            printf ("Stan may be honest\n");

    }

    return 0;
}

// @END_OF_SOURCE_CODE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s