Stone Game 3
InterviewTime limit1sMemory limit128 MB
Two players alternately take 1, 3, or 4 stones from a pile of N, and the program reports whether the first player wins with perfect play.
- Level
Easy3 of 10
- Topics
- Dynamic programming, Game theory
- Solved
- No attempts yet
Problem
The stone game is a game for two players.
There are stones on a table. Sanggeun and Changyeong take stones in alternating turns, and on one turn a player can take 1, 3, or 4 stones. The player who takes the last stone wins.
Write a program that finds the winner when both players play perfectly. Sanggeun starts the game.
Input
The first line contains . ()
Output
Print SK if Sanggeun wins the game, or CY if Changyeong wins the game.