zoukankan      html  css  js  c++  java
  • 赚了还是亏了

    #include<stdio.h>

    int main()

    {

          int m,s,u,h,t;

          char c;
          s=u=h=t=m=0;
          while((ch=getchar())!=$){
               if(t==1){
                     switch(c){
                          case T:printf("D");s+=2;m+=7;break;
                          case X:printf("U");u+=1;break;
                          case C:printf("!");h+=2;m-=3;break;
                     }
               else printf("-"); 
               if(h>0)
                     h--;
                    t=1;
               else  if(h>0&&s>0)
                    h--;
                    s--;
                    t=1;
              else if(h>0&&u>0)
                    h--;
                   u--;
                   t=1;
             else if(h<=0&&s>0)
                   s--;
                   t=0;
             else if(h<=0&&u>0)
                   u--;
                   t=0;
             if(h=0&&s=0&&u=0)
                     t=1;
              scanf("%c",&c);
         }
         printf(" %d",m);

    return 0;
    }
    设计思路

    本题调试过程碰到问题及解决办法
           注意1:当第一次派出老鼠,如果老鼠高兴时,不会出现老鼠不高兴的情况所以可以不用再把s<0,u<0。
  • 相关阅读:
    2015-04
    2014-12
    2014-9
    nginx中ngx_http_ssl_module模块
    nginx中ngx_http_gzip_module模块
    Nginx中ngx_http_log_module模块
    Nginx中ngx_http_auth_basic_moudel和ngx_http_stub_status_module模块
    nginx中ngx_http_access_module模块
    nginx中ngx_http_core_module模块
    Nginx安装
  • 原文地址:https://www.cnblogs.com/hunan-hengyang/p/10398906.html
Copyright © 2011-2022 走看看