CF317D.Game with Powers
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vasya and Petya wrote down all integers from 1 to n to play the "powers" game (n can be quite large; however, Vasya and Petya are not confused by this fact).
Players choose numbers in turn (Vasya chooses first). If some number x is chosen at the current turn, it is forbidden to choose x or all of its other positive integer powers (that is, _x_2, _x_3, ...) at the next turns. For instance, if the number 9 is chosen at the first turn, one cannot choose 9 or 81 later, while it is still allowed to choose 3 or 27. The one who cannot make a move loses.
Who wins if both Vasya and Petya play optimally?
瓦西娅和佩佳写下了从 1 到 n 的所有整数来玩“幂次”游戏(n 可能非常大;不过,瓦西娅和佩佳对此毫不困惑)。
两名玩家轮流选择数字(瓦西娅先手)。若在当前回合选择了某个数 x,则在后续回合中禁止再选择 x 本身及其所有其他正整数幂(即 x2,x3,…)。例如,若第一回合选择了 9,则之后不能再选 9 或 81,但仍然可以选 3 或 27。无法进行合法操作的玩家判负。
若双方均以最优策略进行游戏,则谁将获胜?
输入格式
Input contains single integer n (1 ≤ n ≤ 109).
输入包含一个整数 n(1 ≤ n ≤ 109)。
输出格式
Print the name of the winner — "Vasya" or "Petya" (without quotes).
打印获胜者的名字——“Vasya”或“Petya”(不带引号)。
输入输出样例
输入#1
1
输出#1
Vasya
输入#2
2
输出#2
Petya
输入#3
8
输出#3
Petya
说明/提示
In the first sample Vasya will choose 1 and win immediately.
In the second sample no matter which number Vasya chooses during his first turn, Petya can choose the remaining number and win.
在第一个样例中,瓦西娅将选择 1 并立即获胜。
在第二个样例中,无论瓦西娅在第一回合选择哪个数,佩佳都可以选择剩下的那个数并获胜。
输入解题思路,AI测评打分。不知道怎么写?