水题 统计0的个数和00的个数然后比较就行了= = 象征性的把代码放上来
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXN = 1000;
char s[MAXN+10];
int main()
{
while(~scanf("%s", s))
{
int cnt0, cnt00, cnt01;
cnt0 = cnt00 = cnt01 = 0;
int Len = strlen(s);
for(int i = 0; i < Len; i++)
{
if(s[i] == '0') {
cnt0++;
if(s[(i+1) % Len] == '0') cnt00++;
else cnt01++;
}
}
if(cnt00 * Len > cnt0 * cnt0) printf("SHOOT\n");
else if(cnt00 * Len < cnt0 * cnt0) printf("ROTATE\n");
else printf("EQUAL\n");
}
}
本文提供了一个简单的算法,用于统计输入字符串中连续0和双连续0的出现次数,并通过比较这些数量来决定输出为SHOOT、ROTATE还是EQUAL。
637

被折叠的 条评论
为什么被折叠?



