决斗(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\n");
33         else if (cnt2*len>cnt0*(cnt2 + cnt3))
34             printf("SHOOT\n");
35         else
36             printf("ROTATE\n");
37     }
38     return 0;
39 }

 

posted @ 2017-10-20 21:35  ouyang_wsgwz  阅读(197)  评论(0编辑  收藏  举报