解题思路:博弈题。模拟然后找规律。对n = 1,2,3,4,5,先考虑。接着到6的时候假设October分别拿1,2,3,4,5,的情况,考虑剩余的在Roy先开始的时候胜负情况。
#include
using namespace std;
typedef long long ll;
typedef long double lf;
typedef unsigned long long ull;
typedef pair<ll,int>P;
const int inf = 0x7f7f7f7f;
const ll INF = 1e16;
const int N = 1e6+10;
const ull base = 131;
const ll mod = 1e9+7;
const double PI = acos(-1.0);
const double eps = 1e-4;inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
inline string readstring(){string str;char s=getchar();while(s==' '||s=='\n'||s=='\r'){s=getchar();}while(s!=' '&&s!='\n'&&s!='\r'){str+=s;s=getchar();}return str;}
int random(int n){return (int)(rand()*rand())%n;}
void writestring(string s){int n = s.size();for(int i = 0;i < n;i++){printf("%c",s[i]);}}
ll fast_power(ll a,ll p){ll ans = 1;while(p){if(p&1) ans = (ans*a)%mod;p >>= 1;a = (a*a)%mod;}return ans;
}int main(){srand((unsigned)time(NULL));int t = read();while(t--){int n = read();if(n%6 == 0) puts("Roy wins!");else puts("October wins!");}return 0;
}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!