| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 11090 |
| 문제명 | Cutting Brownies |
| 레벨 | 플래티넘 2 |
| 분류 |
게임이론 |
| 시간복잡도 | O(T*(B+D)) |
| 인풋사이즈 | T<=10, B<=500, D<=500 |
| 사용한 언어 | Python 3.13 |
| 제출기록 | 32412KB / 36ms |
| 최고기록 | 36ms |
| 해결날짜 | 2026/03/04 |
"""Solution code for "BOJ 11090. Cutting Brownies".
- Problem link: https://www.acmicpc.net/problem/11090
- Solution link: http://www.teferi.net/ps/problems/boj/11090
Tags: [game theory]
"""
import sys
from teflib import psutils
@psutils.run_n_times
def main():
B, D, S = sys.stdin.readline().split()
h_count, v_count =int(D).bit_length(), int(B).bit_length()
harry_can_win = h_count > v_count or (h_count == v_count and S == 'Vicky')
can_win = harry_can_win if S == 'Harry' else not harry_can_win
print(S, 'can win' if can_win else 'cannot win')
if __name__ == '__main__':
main()