天天看點

hiho 44 博弈遊戲·Nim遊戲問題代碼

問題

http://hihocoder.com/contest/hiho44/problem/1

代碼

博弈論中的Nim遊戲是經典的公平組合遊戲(ICG)

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int a =;
    scanf("%d", &n);
    int ret =;
    for(int i=; i<n; ++i)
        scanf("%d", &a), ret ^= a;
    printf("%s\n", ret==? "Bob":"Alice");
    return ;
}