HDU 3951 Coin Game(环形博弈)

http://acm.hdu.edu.cn/showproblem.php?pid=3951

#include <bits/stdc++.h>

using namespace std;
int t, n, k;

int main() {
    //freopen("in","r",stdin);
    ios::sync_with_stdio(0);
    cin >> t;
    for (int i = 1; i <= t; i++) {
        cout << "Case " << i << ": ";
        cin >> n >> k;
        if (k == 1) {
            if (n & 1) cout << "first" << endl;
            else cout << "second" << endl;
        } else {
            if (n <= k)
                cout << "first" << endl;
            else cout << "second" << endl;

        }
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/xcfxcf/p/12559981.html