poj 2328(水题,注意审题)
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int main(){ int p; char a[10]; int s=0,e=11; while(true){ scanf("%d",&p); if(p==0)break; gets(a); if(!strcmp(a,"right on")){ if(s<e&&p>s&&p<e) printf("Stan may be honest\n"); else printf("Stan is dishonest\n"); s = 0; e = 11; } else if(!strcmp(a,"too high")) e = min(e,p); else if(!strcmp(a,"too low")) s = max(s,p); } return 0; }

浙公网安备 33010602011771号