ural 2068 - Game of Nuts 博弈水題

題意:給出n個奇數,每個大於1的奇數又可以分解成三個奇數,Daenerys先分,最先不能繼續分的輸,問誰贏。

每個數字x總能分解x/2次,把可以分解的總次數加起來判斷奇偶就可以了。

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main() {
    int n, i, a;
    while(~scanf("%d", &n)) {
        int ans = 0;
        while(n--) {
            scanf("%d", &a);
            ans += a / 2;
        }
        if(ans & 1)
            printf("Daenerys\n");
        else printf("Stannis\n");
    }
    return 0;
}


發佈了67 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章