2021 ICPC Jiangxi Province College Students Programming Competition H Hearthstone So Easy

Title link: Click to jump
title meaning: Each player starts with n points of health, and can cause k points of damage or restore k points of health in each round (the health value cannot exceed the upper limit). At the same time, each player enters a state of fatigue. That is, you will be damaged at the beginning of the round (the i-th own round will receive i damage), and if the HP is 0, you will lose, and ask who can win.

Idea: I simply pushed and found that the second player could not be solved in the first round. The first player will lose because the fatigue value will be higher. That is, when n > k + 1, the first player will lose, and the first player will win at other times (Note that starting with only 1 health will fail at the start).

code show as below:

#include<bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    int T;
    cin >> T;
    while (T--) {
        int n, m;
        cin >> n >> m;
        if (n <= m + 1 && n > 1) {
            cout << "pllj" << endl;
        } else {
            cout << "freesin" << endl;
        }
    }
    return 0;
}

Leave a Comment

Your email address will not be published. Required fields are marked *