-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicpc4335.cpp
More file actions
38 lines (37 loc) · 970 Bytes
/
icpc4335.cpp
File metadata and controls
38 lines (37 loc) · 970 Bytes
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
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
const string HIGH = "too high";
const string LOW = "too low";
const string RIGHT = "right on";
const string HONEST = "Stan may be honest\n";
const string DISHONEST = "Stan is dishonest\n";
while (true) {
int s = 1, e = 10, answer;
while (true) {
string str;
cin >> answer;
if (!answer) break;
getline(cin, str);
getline(cin, str);
if (str == HIGH)
e = min(e, answer - 1);
else if (str == LOW)
s = max(s, answer + 1);
else
break;
}
if (!answer)
break;
else if (answer < s || e < answer)
cout << DISHONEST;
else
cout << HONEST;
}
return 0;
}