Gym - 100952G
Posted starry
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gym - 100952G相关的知识,希望对你有一定的参考价值。
G. The jar of divisors
Alice and Bob play the following game. They choose a number N to play with. The rules are as follows:
- They write each number from 1 to N on a paper and put all these papers in a jar.
- Alice plays first, and the two players alternate.
- In his/her turn, a player can select any available number M and remove its divisors including M.
- The person who cannot make a move in his/her turn wins the game.
Assuming both players play optimally, you are asked the following question: who wins the game?
The first line contains the number of test cases T (1 ?≤? T ?≤? 20). Each of the next T lines contains an integer (1 ?≤? N ?≤?1,000,000,000).
Output T lines, one for each test case, containing Alice if Alice wins the game, or Bob otherwise.
2
5
1
Alice
Bob
博弈论题目。1就是Bob赢否则就是Alice赢,不知道怎么来的,算了8个发现只有1是Bob赢就这样写了,没想到还真过了。
1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <algorithm> 5 #define ll long long 6 using namespace std; 7 int main(){ 8 int t,n; 9 cin>>t; 10 while(t--){ 11 cin>>n; 12 if(n == 1){ 13 cout << "Bob\n"; 14 }else cout << "Alice\n"; 15 } 16 return 0; 17 }
以上是关于Gym - 100952G的主要内容,如果未能解决你的问题,请参考以下文章
解决使用Monitor出现gym.error.DependencyNotInstalled: Found neither the ffmpeg nor avconv executables的问题(代码