Stone Game 4
InterviewTime limit1sMemory limit128 MB
Two players alternately take 1, 3, or 4 stones and the player taking the last stone loses; report whether the first player wins with optimal 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 Changyoung take stones in alternating turns, and a player can take 1, 3, or 4 stones per turn. The player who takes the last stone loses the game.
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, or CY if Changyoung wins.