https://devjeong.com/algorithm/algorithm-1/
무슨 문제를 풀까 하다가 이곳에서 풀 문제를 정하여 풀고자 한다!
[Algorithm] 백준 문제 추천
devjeong.com
def stone_game():
num = int(input())
dp = [0 for i in range(num+1)]
for i in range(1, num+1):
dp[i] = int(i/3) + int(i%3)
#print(i, dp[i])
if dp[num] % 2 == 1:
print('SK')
else:
print('CY')
stone_game()
만약 dp[i]의 i 자리에 2가 들어오면 CK승, 3이 들어오면 SK 승 ... 이런 식으로 확장.
문제 링크
https://www.acmicpc.net/problem/9655
9655번: 돌 게임
상근이가 게임을 이기면 SK를, 창영이가 게임을 이기면 CY을 출력한다.
www.acmicpc.net
'알고리즘' 카테고리의 다른 글
백준 10845 - 큐 (class2) (0) | 2023.05.07 |
---|---|
백준 10828 - 스택 (class2) (0) | 2023.05.07 |
Leetcode 316 - Remove Duplicate Letters (python) (0) | 2023.04.09 |
Leetcode 1 - two sum (python) (0) | 2023.04.09 |
백준 11650 - 좌표 정렬하기 (python) (0) | 2023.04.02 |