UVA1636Headshot

//UVA1636Headshot
#include
#include
const int maxn = 100;
char s[maxn + 10];
int zero, shoot;
int main() {
	while(scanf("%s", s) == 1) {
		zero = shoot = 0;
		int len = strlen(s);
        if(len == 1 && s[0] == '0') {
        	printf("SHOOT\n"); continue;
		}
		int i;
		for(i = 0; i < len - 1; i++) {
			if(s[i] == '0') zero++;
			if(s[i + 1] == '0' && s[i] == '0') shoot++;
		}
		if(s[i] == '0') zero++;
		if(s[(i + 1) % len] == '0' && s[i] == '0') shoot++;

		if(shoot * len > zero * zero) printf("SHOOT\n"); 
		else if(shoot * len == zero * zero) printf("EQUAL\n");
		else printf("ROTATE\n");
	}
	return 0;
}
/*
0011
0111
000111
*/

你可能感兴趣的:(UVA,数学)