pku2328.cpp

来自「这是ACM 方面的资料 是PKU的 北京大学的出来的」· C++ 代码 · 共 43 行

CPP
43
字号
#include "stdio.h"
int main()
{
	int tn,high=10,low=1;
	char s[5];
	
	while(scanf("%d%*s%s",&tn,s)!=-1&&tn!=0)
	{
		high=10,low=1;
		
		if(s[0]=='h')
		{
			high=(high>=tn)?tn-1:high;	
		}
		else if(s[0]=='l')
		{
			low=(low<=tn)?tn+1:low;	
		}
			
		while(s[0]!='o'&&scanf("%d%*s%s",&tn,s)!=-1&&s[0]!='o')
		{
			if(s[0]=='h')
			{
				high=(high>=tn)?tn-1:high;	
			}
			else if(s[0]=='l')
			{
				low=(low<=tn)?tn+1:low;	
			}	
		}
		if(high>=tn&&low<=tn)
		{
			printf("Stan may be honest\n");
		}
		else
		{
			printf("Stan is dishonest\n");	
		}		
	}
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?