Created
January 18, 2026 01:07
-
-
Save maehrm/fc7b5eed029f0d3f7db626527ca157d7 to your computer and use it in GitHub Desktop.
D - Prime Sum Game https://atcoder.jp/contests/abc239/tasks/abc239_d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_prime_list(n): | |
| prime_list = [True for _ in range(n + 1)] | |
| prime_list[0] = prime_list[1] = False | |
| for p in range(2, int(n**0.5) + 1): | |
| if prime_list[p]: | |
| i = p * p | |
| while i <= n: | |
| prime_list[i] = False | |
| i += p | |
| return [i for i, v in enumerate(prime_list) if v] | |
| A, B, C, D = map(int, input().split()) | |
| plist = set(get_prime_list(200)) | |
| for x in range(A, B + 1): | |
| f = True | |
| for y in range(C, D + 1): | |
| if x + y in plist: | |
| f = False | |
| break | |
| if f: | |
| print("Takahashi") | |
| break | |
| else: | |
| print("Aoki") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment