301675: CF317D. Game with Powers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Game with Powers

题意翻译

### 题目描述 Vasya 和 Petya 写下了 $1\sim n$ 的所有整数来玩“乘方”游戏($n$ 可以很大,但是,Vasya 和 Petya 并不被此事实迷惑)。 玩家轮流选择数(Vasya 先选)。如果这一轮 $x$ 被选择,以后将不能选择 $x$ 或其所有正整数幂(也就是 $x^2,x^3,\dots$)。例如,如果 $9$ 在第一轮被选择,玩家以后将不能选择 $9$ 或 $81$,但是仍然可以选择 $3$ 或 $27$。如果一个玩家不能再选数了,他就输了。 如果 Vasya 和 Petya 两个人都以最佳方案玩,那么谁会赢? ### 输入格式 输入一个整数 $n$($1\le n\le 10^9$)。 ### 输出格式 输出赢家的名字,`Vasya` 或 `Petya`。 ### 说明/提示 在样例 $1$ 中,Vasya 将选 $1$,然后立即胜利。 在样例 $2$ 中,不管 Vasya 第一轮选什么数,Petya 可以选剩余的数然后胜利。

题目描述

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?

输入输出格式

输入格式


Input contains single integer $ n $ ( $ 1<=n<=10^{9} $ ).

输出格式


Print the name of the winner — "Vasya" or "Petya" (without quotes).

输入输出样例

输入样例 #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.

Input

题意翻译

### 题目描述 Vasya 和 Petya 写下了 $1\sim n$ 的所有整数来玩“乘方”游戏($n$ 可以很大,但是,Vasya 和 Petya 并不被此事实迷惑)。 玩家轮流选择数(Vasya 先选)。如果这一轮 $x$ 被选择,以后将不能选择 $x$ 或其所有正整数幂(也就是 $x^2,x^3,\dots$)。例如,如果 $9$ 在第一轮被选择,玩家以后将不能选择 $9$ 或 $81$,但是仍然可以选择 $3$ 或 $27$。如果一个玩家不能再选数了,他就输了。 如果 Vasya 和 Petya 两个人都以最佳方案玩,那么谁会赢? ### 输入格式 输入一个整数 $n$($1\le n\le 10^9$)。 ### 输出格式 输出赢家的名字,`Vasya` 或 `Petya`。 ### 说明/提示 在样例 $1$ 中,Vasya 将选 $1$,然后立即胜利。 在样例 $2$ 中,不管 Vasya 第一轮选什么数,Petya 可以选剩余的数然后胜利。

加入题单

算法标签: