Luo Gu P4860 Roy & October to take the stones II solution to a problem of game theory

Topic links: https://www.luogu.org/problem/P4860
and "P4018 Roy & October to take the stone," as the derivation of ideas, go cycling festival.
It can be found: as long as the win is not divisible by four states, as long as the losing state is divisible by four.
Codes are as follows:

#include <bits/stdc++.h>
using namespace std;
int T, n;
int main() {
    cin >> T;
    while (T --) {
        cin >> n;
        puts( n % 4 ? "October wins!" :"Roy wins!" );
    }
    return 0;
}

Guess you like

Origin www.cnblogs.com/codedecision/p/11793933.html