ZOJ Problem Set - 1926 Guessing Game

这题还是蛮有趣的。但是很水。直接标记就可以了!

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

int main()
{
    char p[10];
    int m,i;
    int a[11];
    memset(a,0,sizeof(a));
    while(cin>>m&&m!=0)
    {
          getchar();
          cin.getline(p,10);
          if(p[4] == 'h'){
          for(i = m;i < 11;i ++)
          a[i] = 1;
          }
          else if(p[4] == 'l')
          {
                for(i = 0;i <= m;i ++)
                  a[i] = 1;
          }
          else if(p[4] == 't')
          {
                if(a[m] == 1) cout<<"Stan is dishonest"<<endl;
                else cout<<"Stan may be honest"<<endl;
                memset(a,0,sizeof(a));
          }
    }
    return 0;
}


你可能感兴趣的:(ZOJ Problem Set - 1926 Guessing Game)