zoukankan      html  css  js  c++  java
  • zoj 1926 Guessing Game

    #include<stdio.h>
    #include<string.h>
    #include<algorithm>
    using namespace std;
    
    int main()
    {
        int a[20],i,j,n,f;
        char s[100];
        memset(a,0,sizeof(a));
        f=1;
        while(~scanf("%d",&n))
        {
            if(n==0) break;
            gets(s);
            if(strcmp(s,"too high")==0)
            {
                for(i=n;i<=10;i++)
                    {
                        if(a[i]==-1) f=0;
                        a[i]=1;
                    }
            }
            else if(strcmp(s,"too low")==0)
            {
                for(i=1;i<=n;i++)
                    {
                        if(a[i]==1) f=0;
                        a[i]=-1;
                    }
            }
            else if(strcmp(s,"right on")==0)
            {
                if(a[n]!=0) f=0;
                if(f)
                //if(a[n]==0)
                    printf("Stan may be honest
    ");
                else printf("Stan is dishonest
    ");
                memset(a,0,sizeof(a));
                f=1;
            }
        }
        return 0;
    }

    版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/

  • 相关阅读:
    133
    132
    131
    130
    129
    128
    2019.10.16考试解题报告
    2019.10.15考试解题报告
    洛谷 P1352 没有上司的舞会
    2019.10.13考试解题报告
  • 原文地址:https://www.cnblogs.com/xryz/p/4847925.html
Copyright © 2011-2022 走看看