ZOJ 1926 Guessing Game
来源:互联网 发布:java compareto 排序 编辑:程序博客网 时间:2024/04/28 11:17
传送门:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1926
题目大意:两人在猜数字,1~10,对于其中一个猜的数,Stan给出"too high", "too low", or "right on".如果Stan给出的是假的,那么输出Stan is dishonest否则输出Stan may be honest 每个例子均以right on结束
注意范围缩小时候输入的x应该在现在的范围内。否则区间就会扩大区间导致WA
#include<cstdio>#include<iostream>#include<cstring>using namespace std;char action[32];int main(){int x;int low=0,high=11;bool ok=true;while(scanf("%d",&x),x){//getchar();gets(action);//cout<<action<<endl;if(strcmp(action,"too high")==0 && x<high )high=x;else if(strcmp(action,"too low")==0 && x>low)low=x;else if(strcmp(action,"right on")==0){if(x<high && x>low )printf("Stan may be honest\n");else printf("Stan is dishonest\n");low=0;high=11;}}}
- zoj 1926 Guessing Game
- ZOJ 1926 Guessing Game
- zoj 1926 Guessing Game
- zoj 1926 || poj 2328 Guessing Game(水~)
- ZOJ Problem Set - 1926 Guessing Game
- Guessing Game
- Guessing Game
- Guessing Game
- Guessing Game
- poj 2328 Guessing Game
- POJ 2328 Guessing Game
- poj2328 Guessing Game
- Guessing Game (P2328)
- poj2328 Guessing Game
- TOJ 1423. Guessing Game
- poj 2328 Guessing Game
- UVa 10530 - Guessing Game
- POJ 2328 Guessing Game
- MiniGUI源码分析——开始篇
- java_web学习第九天(JDBC数据库驱动------基础知识)
- Android makefile文件详解
- php无限循环分类小例子
- spring mvc 文件上传下载
- ZOJ 1926 Guessing Game
- (11) - 泛型 (图)
- 需要考虑的语句
- Ubuntu 初始设置
- ASP.NET验证视图状态MAC失败问题分析与解决
- 设计模式之建造者(builder)模式
- Java的抽象类abstract和接口interface的异同点
- android_如何判断一个应用程序在运行
- Tomcat提供的安全机制