Gym 100952 G. The jar of divisors
2 seconds
64 megabytes
standard input
standard output
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
这道题我自己都有点迷茫,是个博弈题,结论就是n%6==1?"Bob":"Alice"
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int main()
{
ll t,n;
scanf("%lld",&t);
while(t--)
{
cin>>n;
if(n%==) puts("Bob");
else puts("Alice");
}
return ;
}
Gym 100952 G. The jar of divisors的更多相关文章
- Gym 100952G&&2015 HIAST Collegiate Programming Contest G. The jar of divisors【简单博弈】
G. The jar of divisors time limit per test:2 seconds memory limit per test:64 megabytes input:standa ...
- codeforces gym 100952 A B C D E F G H I J
gym 100952 A #include <iostream> #include<cstdio> #include<cmath> #include<cstr ...
- Gym 100952 D. Time to go back(杨辉三角形)
D - Time to go back Gym - 100952D http://codeforces.com/gym/100952/problem/D D. Time to go back time ...
- Gym 100952 H. Special Palindrome
http://codeforces.com/gym/100952/problem/H H. Special Palindrome time limit per test 1 second memory ...
- Gym 100952 F. Contestants Ranking
http://codeforces.com/gym/100952/problem/F F. Contestants Ranking time limit per test 1 second memor ...
- Gym 100952 D. Time to go back
http://codeforces.com/gym/100952/problem/D D. Time to go back time limit per test 1 second memory li ...
- Gym 100952 C. Palindrome Again !!
http://codeforces.com/gym/100952/problem/C C. Palindrome Again !! time limit per test 1 second memor ...
- Codeforces Gym 100513G G. FacePalm Accounting
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100637G G. #TheDress 暴力
G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...
随机推荐
- 洛谷P3332 [ZJOI2013]K大数查询 权值线段树套区间线段树_标记永久化
Code: #include <cstdio> #include <algorithm> #include <string> #include <cstrin ...
- 监控memcached服务
#!/bin/bash #监控memcached服务 printf "del key\r\n" | nc 127.0.0.1 11211 &>/dev/null #使 ...
- .NET 将 .config 文件嵌入到程序集
原文:.NET 将 .config 文件嵌入到程序集 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/Iron_Ye/article/details/ ...
- 极速响应Excel数据报表请求的一种方法
摘要 通过缓存和维护Excel Workbook实例,极速响应Excel数据报表请求. 这是一个真实的大数据"云计算"项目中的解决方案,在给定的时间和资源下,只有这种方法是最简单并 ...
- ECNUOJ 2147 字符环
字符环 Time Limit:1000MS Memory Limit:65536KBTotal Submit:562 Accepted:146 Description 字符环:就是将给定的一个字符串 ...
- POI0109 POD (最短路)
POI0109 POD (最短路) 版权声明:本篇随笔版权归作者YJSheep(www.cnblogs.com/yangyaojia)所有,转载请保留原地址! 现在让我们来对一个交通运输图进行研究,这 ...
- HTML学习----------DAY2第五节
属性为 HTML 元素提供附加信息. HTML 属性 HTML 标签可以拥有属性.属性提供了有关 HTML 元素的更多的信息. 属性总是以名称/值对的形式出现,比如:name="value& ...
- [Python] Generating random numbers using numpy lib
import numpy as np def test_run(): data=np.random.random((3,4)) """ [[ 0.80150549 0.9 ...
- js 阻断网页选中和右键
$(document).bind("contextmenu", function () { return false; }); $(document).bind("sel ...
- cocos2d-x 3.0正式版 vs2013配置
cocos2d-x 3.0正式版与之前的版本号差异较大,曾经的教程非常多都不使用了. 1.从cocos2d-x官网http://www.cocos2d-x.org下载3.0版的压缩包,随便解压一个位置 ...