`
caoruntao
  • 浏览: 468504 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

字符串:zoj 1926 || poj 2328 Guessing Game

 
阅读更多

【转】http://blog.csdn.net/zxy_snow/article/details/6038536

 

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <limits.h>
using namespace std;
int main(void)
{
	int n,begin = 0,end = INT_MAX;
	int x;
	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;
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics