模拟猜数(POJ2328)
2016-05-12 20:54
190 查看
题目链接:http://poj.org/problem?id=2328
解题报告:
缩短区间,soeasy,
解题报告:
缩短区间,soeasy,
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> #include <limits.h> using namespace std; int main() { int n,begin = 0,end = INT_MAX; char str[10]; while( cin >> n && n ) { getchar(); begin = 0,end = INT_MAX; while ( gets(str) && strcmp(str,"right on") ) { if( strcmp(str,"too high") == 0 && n < end ) end = n; else if( strcmp(str,"too low") == 0 && n > begin ) begin = n; cin >> n; getchar(); } if( n > begin && n < end ) printf("Stan may be honest\n"); else printf("Stan is dishonest\n"); } return 0; }
相关文章推荐
- 生成1-n的排列
- zoj水题分类(自己练习)
- awk 参考
- 三种方法遍历ArrayList
- 启动hive报错:[ERROR] Terminal initialization failed; falling back to unsupported
- JAVA编写简单的http服务器
- sql中的行转列和列转行的问题
- SNF微信公众号客户端演示-微信开发客户端能干什么
- 斜率优化dp专题学习
- 亿级用户下的新浪微博平台架构
- 鸡兔同笼
- 排列组合问题
- 蓝桥杯 车票找零
- 【Objective-C】OC中键值编码(KVC)的概念和使用方法
- POJ 3061 - Subsequence
- 安卓之窗口机制初涉(一)
- 238. Product of Array Except Self
- 八大排序之插入排序
- 利用Runtime实现对Json数据的ORM框架
- Android的单位和尺寸