UVA 1636 Headshot——概率水题

来源:互联网 发布:mars安卓视频教程json 编辑:程序博客网 时间:2024/05/29 03:03
#include <cstdio>#include <cstring>using namespace std;int main() {    char str[110];    while (gets(str) != NULL) {        int a = 0, b = 0, c = strlen(str);        for (int i = 0; i < c - 1; i++) {            if (str[i] == '0') {                a++;                if (str[i + 1] == '0') b++;            }        }        if (str[c - 1] == '0') {            a++;            if (str[0] == '0') b++;        }        double shoot = 1.0 * b / (1.0 * a);        double rotat = 1.0 * a / (1.0 * c);        if (shoot == rotat) printf("EQUAL\n");        else if (shoot > rotat) printf("SHOOT\n");        else printf("ROTATE\n");    }    return 0;}