zoukankan      html  css  js  c++  java
  • 决斗(Headshot )

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<algorithm>
     4 using namespace std;
     5 
     6 const int maxn = 105;
     7 char s[maxn];
     8 int cnt0, cnt1, cnt2, cnt3;
     9 
    10 int main()
    11 {
    12     while (scanf("%s", s + 1) != EOF)
    13     {
    14         cnt0 = 0;
    15         cnt2 = 0;
    16         cnt3 = 0;
    17         int len = strlen(s + 1);
    18         s[0] = s[len];    //s[0]=字符串的长度
    19         s[len + 1] = s[1];
    20         for (int i = 1; i <= len; i++)
    21         {
    22             if (s[i] == '0')
    23             {
    24                 cnt0++;
    25                 if (s[i + 1] == '0')
    26                     cnt2++;
    27                 if (s[i + 1] == '1')
    28                     cnt3++;
    29             }
    30         }
    31         if (cnt2*len == cnt0*(cnt2 + cnt3))
    32             printf("EQUAL
    ");
    33         else if (cnt2*len>cnt0*(cnt2 + cnt3))
    34             printf("SHOOT
    ");
    35         else
    36             printf("ROTATE
    ");
    37     }
    38     return 0;
    39 }
  • 相关阅读:
    [HNOI 2003] 消防局的设立
    Codeforces 341
    CF 专栏
    TC SRM 570
    TC SRM 588
    TC SRM 589
    TC专栏
    BZOJ 第二十一页 除草
    BZOJ 第二十二页 除草
    BZOJ 第二十三页 除草
  • 原文地址:https://www.cnblogs.com/ouyang_wsgwz/p/7701752.html
Copyright © 2011-2022 走看看