| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 7654 |
| 문제명 | Number Game |
| 레벨 | 골드 3 |
| 분류 |
게임 이론 |
| 시간복잡도 | O(T) |
| 인풋사이즈 | T<=? |
| 사용한 언어 | Python 3.11 |
| 제출기록 | 31120KB / 40ms |
| 최고기록 | 40ms |
| 해결날짜 | 2023/12/13 |
"""Solution code for "BOJ 7654. Number Game".
- Problem link: https://www.acmicpc.net/problem/7654
- Solution link: http://www.teferi.net/ps/problems/boj/7654
Tags: [game thoery]
"""
import sys
END_OF_INPUT = '0'
CANNOT_WIN_STRATEGY = '20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1'
def main():
while (line := sys.stdin.readline().rstrip()) != END_OF_INPUT:
N = int(line)
a = sys.stdin.readline().rstrip()
cannot_win = (N == 21) or (N % 21 == 0 and a == CANNOT_WIN_STRATEGY)
print('Carl can\'t win' if cannot_win else 'Carl can win')
if __name__ == '__main__':
main()