// UVa 10530 - Guessing Game
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string a, b;
int mn = 0, mx = 11;
bool truth = true;
while ((cin >> n) && (n != 0)) {
cin >> a >> b;
if (b == "high")
mx = min(mx, n);
else if (b == "low")
mn = max(mn, n);
else if (b == "on") {
truth = truth && (mn < n && n < mx);
if (truth)
cout << "Stan may be honest\n";
else
cout << "Stan is dishonest\n";
mn = 0;
mx = 11;
truth = true;
}
}
if (b != "on") {
if (truth && mn < mx)
cout << "Stan may be honest\n";
else
cout << "Stan is dishonest\n";
}
return 0;
}
Monday, August 17, 2015
UVa 10530 - Guessing Game
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment