POJ 2328 Guessing Game
来源:互联网 发布:淘宝网店域名怎么改 编辑:程序博客网 时间:2024/05/10 07:08
Description
Stan and Ollie are playing a guessing game. Stan thinks of a number between 1 and 10 and Ollie guesses what the number might be. After each guess, Stan indicates whether Ollie's guess is too high, too low, or right on.
After playing several rounds, Ollie has become suspicious that Stan cheats; that is, that he changes the number between Ollie's guesses. To prepare his case against Stan, Ollie has recorded a transcript of several games. You are to determine whether or not each transcript proves that Stan is cheating.
After playing several rounds, Ollie has become suspicious that Stan cheats; that is, that he changes the number between Ollie's guesses. To prepare his case against Stan, Ollie has recorded a transcript of several games. You are to determine whether or not each transcript proves that Stan is cheating.
Input
Standard input consists of several transcripts. Each transcript consists of a number of paired guesses and responses. A guess is a line containing single integer between 1 and 10, and a response is a line containing "too high", "too low", or "right on". Each game ends with "right on". A line containing 0 follows the last transcript.
Output
For each game, output a line "Stan is dishonest" if Stan's responses are inconsistent with the final guess and response. Otherwise, print "Stan may be honest".
Sample Input
10too high3too low4too high2right on5too low7too high6right on0
Sample Output
Stan is dishonestStan may be honest
#include<cstdio>#include<iostream>#include<cstring>#include<map>#include<queue>#include<stack>#include<algorithm>#include<cmath>#include<string>using namespace std;const int maxn=100005;int tot,n;int a[maxn],b[maxn];string s1,s2;int main(){tot=0;while (cin>>n,n){cin>>s1>>s2;if (s1=="right"){int flag=1;for (int i=0;i<tot;i++){if (b[i]==-1&&a[i]>=n) flag=0;if (b[i]==1&&a[i]<=n) flag=0;}if (flag) printf("Stan may be honest\n");else printf("Stan is dishonest\n");tot=0;}else {a[tot]=n;if (s2=="low") b[tot++]=-1;else b[tot++]=1;}}return 0;}
0 0
- poj 2328 Guessing Game
- POJ 2328 Guessing Game
- poj 2328 Guessing Game
- POJ 2328 Guessing Game
- POJ 2328 Guessing Game G++
- zoj 1926 || poj 2328 Guessing Game(水~)
- POJ 2328 Guessing Game(水~)
- poj 3589 Number-guessing Game
- Poj 2328 Guessing Game(猜数字游戏)
- poj 3589 Number-guessing Game(水题)
- POJ 3589 Number-guessing Game(简单题)
- 【贪心】【poj 4028】GCD Guessing Game
- POJ 3589 Number-guessing Game(水~)
- POJ 3589 Number-guessing Game G++
- Guessing Game
- Guessing Game
- Guessing Game
- Guessing Game
- 原码,补码,反码
- 【机房重构】最后总结
- 【Android】检测app是否安装、安装并打开的方法
- 设计模式_建造者模式
- Myeclipse验证js语法报错
- POJ 2328 Guessing Game
- top 25 论文
- Intersection (计算几何)
- 解题报告: 商品推荐走马灯
- log4j:WARN Please initialize the log4j system properly解决办法
- div、css入门练习
- CodeForces 402A
- FZU2184 逆序数还原
- 每天学习一点新东西——vim篇(二)