【題解】ZeroJudge c876: 107北二3.馬步求勝遊戲

【題目敘述】https://zerojudge.tw/ShowProblem?problemid=c876

#include <iostream>
#include <cstring>
using namespace std;

int x, y;

int main() {
    cin >> x >> y;
    int mn = min(x, y), ans;
    if (mn % 3 == 1) ans = mn / 3 * 2;
    else if (x == y && mn % 3 == 2) ans = mn / 3 * 2;
    else ans = (mn-1) / 3 * 2 + 1;
    if (ans % 2 == 1) cout << "Win " << ans << "\n";
    else cout << "Lose " << ans << "\n";
}
分享本文 Share with friends