Stone Game 7
Time limit1sMemory limit128 MB
Two players alternately remove a power of four stones from the pile, and the program reports the winner when both play perfectly.
- Level
Medium5 of 10
- Topics
- Game theory, Math
- Solved
- No attempts yet
Problem
The stone game is played by two people who take stones in alternating turns.
There are stones on the table. Sang-Keun and Chang-Young take turns, and on one turn a player takes exactly stones. Here is an integer with , so the possible counts are 1, 4, 16, 64, and so on. The player who has no legal way to take stones on their turn loses the game.
Both players play perfectly. Write a program that finds the winner. Sang-Keun starts the game.
Input
The first line contains the number of stones . ()
Output
Print SK if Sang-Keun wins the game, or CY if Chang-Young wins.