歼灭弱题3

我最早在 长毛猴子 李咏主持的幸运52中看到的猜数游戏
ZOJ1926
#include <iostream>
#include <string>
using namespace std;
int main()
{
 int start,end;
 bool ans=false;
 int current;
 string act;
 start=0;
 end=100;
 while(cin >> current)
 {
  if(current==0)
   break;
  cin >> act;
  cin >> act;
  if(act=="low")
  {
   if(start<current)
    start=current;
   if(start>=end)
    ans=true;
  }
  else if(act=="high")
  {
   if(end>current)
    end=current;
   if(start>=end)
    ans=true;
  }
  else if(act=="on")
  {
   if(!(current>start&&current<end))
    ans=true;
   if(ans==true)
    cout << "Stan is dishonest" << endl;
   else
    cout << "Stan may be honest" << endl;
   ans=false;start=0;end=100;
  }
 }
 return 0;
}
posted on 2006-08-08 00:27  AnewR  阅读(135)  评论(0)    收藏  举报