303096: CF603C. Lieges of Legendre
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Lieges of Legendre
题意翻译
有两个人做游戏,游戏规则如下: 有n堆石子,每次可以对一堆石子进行操作,如果当前石子是偶数,那么可以选择将这2*x个石子分成k堆石子数为x的石子堆,还有一种没有前提的操作是取走当前堆的一个石子,问先手赢还是后手赢,先手和后手都足够聪明的情况下。 先手赢输出Kevin,后手赢输出Nicky 输入: 第一行两个整数n,k 第二行n个整数,为每堆石子的数量 输出:Kevin或者Nicky题目描述
Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are $ n $ piles of cows, with the $ i $ -th pile containing $ a_{i} $ cows. During each player's turn, that player calls upon the power of Sunlight, and uses it to either: 1. Remove a single cow from a chosen non-empty pile. 2. Choose a pile of cows with even size $ 2·x $ ( $ x>0 $ ), and replace it with $ k $ piles of $ x $ cows each. The player who removes the last cow wins. Given $ n $ , $ k $ , and a sequence $ a_{1},a_{2},...,a_{n} $ , help Kevin and Nicky find the winner, given that both sides play in optimal way.输入输出格式
输入格式
The first line of the input contains two space-separated integers $ n $ and $ k $ ( $ 1<=n<=100000,1<=k<=10^{9} $ ). The second line contains $ n $ integers, $ a_{1},a_{2},...\ a_{n} $ ( $ 1<=a_{i}<=10^{9} $ ) describing the initial state of the game.
输出格式
Output the name of the winning player, either "Kevin" or "Nicky" (without quotes).
输入输出样例
输入样例 #1
2 1
3 4
输出样例 #1
Kevin
输入样例 #2
1 2
3
输出样例 #2
Nicky