forked from sitz/UVa-Online-Judge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path10530.cpp
77 lines (73 loc) · 962 Bytes
/
10530.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <bits/stdc++.h>
using namespace std;
int num;
char cmd[30];
int MIN, MAX;
bool cheat;
void Input()
{
cin.get();
while (cin.getline(cmd, 30))
{
if (!strcmp(cmd, "right on"))
{
break;
}
if (!strcmp(cmd, "too high"))
{
if (num <= MAX)
{
MAX = num - 1;
}
}
if (!strcmp(cmd, "too low"))
{
if (num >= MIN)
{
MIN = num + 1;
}
}
if (MIN > MAX)
{
cheat = true;
}
if (num > MAX && !strcmp(cmd, "too low"))
{
cheat = true;
}
if (num < MIN && !strcmp(cmd, "too high"))
{
cheat = true;
}
// cout<<"["<<MIN<<","<<MAX<<"]"<<endl;
cin >> num;
cin.get();
}
if (MIN > MAX)
{
cheat = true;
}
if (num < MIN || num > MAX)
{
cheat = true;
}
}
int main()
{
while (cin >> num && num)
{
cheat = false;
MIN = 0;
MAX = 11;
Input();
if (cheat)
{
cout << "Stan is dishonest" << endl;
}
else
{
cout << "Stan may be honest" << endl;
}
}
return 0;
}