-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10530 - Guessing Game.cpp
58 lines (49 loc) · 1.06 KB
/
10530 - Guessing Game.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
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
string s;
vector <int> v1, v2;
while(cin >> n)
{
if(n == 0)
{
break;
}
getchar();
getline(cin, s);
if(s == "right on")
{
vector <int> :: iterator it1,it2;
int mx = 0, mn = 11;
// cout<<*it1 << " " << *it2 << endl;
if(v2.size() > 0)
for(int i = 0; i < v2.size(); i++)
{
mx = max(mx, v2[i]);
}
if(v1.size() > 0)
for(int i = 0; i < v1.size(); i++)
mn = min(mn, v1[i]);
if(n > mx && n < mn)
{
cout<<"Stan may be honest"<< endl;
}
else
{
cout<<"Stan is dishonest" << endl;
}
v1.clear();
v2.clear();
}
else if(s == "too high")
{
v1.push_back(n);
}
else
{
v2.push_back(n);
}
}
}