Roy & October of taking stones

【TimeGate】

https://www.luogu.org/problem/P4018

[Problem-solving ideas]

Truth: Only a multiple of 6 is the second person to win, otherwise the first person to win

【code】

 1 #include <cstdio>
 2 #include <iostream>
 3 #include <algorithm>
 4 using namespace std;
 5 int T,n;
 6 int main(){
 7     //freopen("4018.in","r",stdin);
 8     //freopen("4018.out","w",stdout);
 9     scanf("%d",&T);
10     while(T--){
11         scanf("%d",&n);
12         if(n%6!=0)printf("October wins!\n");
13         else printf("Roy wins!\n");
14     }
15     return 0;
16 }

 

Guess you like

Origin www.cnblogs.com/66dzb/p/11515462.html