当前位置: 代码迷 >> 综合 >> BUPT OJ148 An Interesting Game
  详细解决方案

BUPT OJ148 An Interesting Game

热度:22   发布时间:2024-01-12 05:26:22.0

题目描述

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(1T1000) , indicating the number of test cases.
The next T lines describe all the test cases, each with an integer  N(1N108) .

输出格式

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;
}


  相关解决方案