Anti-Nim游戏

XDOJ-最后一个open in new window

分析

实现

#include <cstdio>
using namespace std;

int main () {
    int n;
    while (scanf("%d", &n) != EOF) {
        bool flag = true;
        int res = 0;
        for (int i = 1, x; i <= n; ++ i) {
            scanf("%d", &x);
            if (x > 1) flag = false;
            res ^= x;
        }

        if (flag == true) {
            printf("%s\n", res != 0 ? "orzwang9897" : "orzwym6912");
        } else {
            printf("%s\n", res != 0 ? "orzwym6912" : "orzwang9897");
        }
    }
    return 0;
}
最后修改于: