您的位置:首页 > 其它

BUPT OJ148 An Interesting Game

2014-03-11 20:49 453 查看


题目描述

Alice and Bob are very smart guys and they like to play all kinds of games in their spare time. It's amazing that they can always find the best strategy, and that's why they feel bored again and again. Recently
they invented a new game, as they usually did. The rule of the new game was quite simple. At the beginning of game, they would write down N numbers(labelled from 1 to N) on a paper, and then they take turns(Alice first) to repeat the following operations:
choose a remaining number, and then erase all of its divisors(if it still remains on the paper). Once a number was erased, no one can choose it again. The games ends when all numbers are erased, and the last one who makes the operations wins.

Here comes the problem: who will win the game if both use the best strategy? Find it out quickly, before they get bored of the game again!


输入格式

The first line contains an integer T(1≤T≤1000),
indicating the number of test cases.

The next T lines describe all the test cases, each with an integer N(1≤N≤108).


输出格式

For each test case in the input, print one line: "Case #X: Y"(note the blanks!), where X is the test case number (starting with 1) and Y is either "Alice" or "Bob".


输入样例

2
2
1024



输出样例

Case #1: Alice
Case #2: Alice


神坑

不管怎么样都是Alice赢, Bob你不反抗么...反抗么....抗么...么...

当时就记得这题坑了半个多小时, 然后就在机房睡着了= = 机房耳机真舒服啊

结果事实上第二场热身赛只打了三个小时左右

然后一觉醒来想出了解答, 果然1Y...求校赛别那么坑orz

什么? 证明? 下次吧, 不过是从同学那里得到了系统的证明 (其实我目测会忘记更新证明的

/*
USER_ID: test#birdstorm
PROBLEM: 148
SUBMISSION_TIME: 2014-03-10 22:28:53
*/
#include <stdio.h>
#include <stdlib.h>
#define For(i,m,n) for(i=m;i<n;i++)

main()
{
int i, j, t, n;
scanf("%d",&t);
For(i,1,t+1){
scanf("%d",&n);
printf("Case #%d: Alice\n",i);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: