Stone Game 2
InterviewTime limit1sMemory limit128 MB
Two players alternately take 1 or 3 stones from a pile of N and the player taking the last stone loses, so print whether the first player wins.
- Level
Easy3 of 10
- Topics
- Game theory, Dynamic programming
- Solved
- No attempts yet
Problem
The stone game is played by two people who take stones in turn.
There are stones on a table. Sanggeun and Changyeong take turns removing stones, and on each turn a player takes either 1 stone or 3 stones. The player who takes the last stone loses the game.
Write a program that finds the winner when both players play the game perfectly. Sanggeun moves first.
Input
The first line contains . ()
Output
Print SK if Sanggeun wins the game, or CY if Changyeong wins the game.