QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#380533#8508. DiviDueloGannyWA 9ms9680kbPython3567b2024-04-07 05:34:272024-04-07 05:34:27

Judging History

你现在查看的是最新测评结果

  • [2024-04-07 05:34:27]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:9680kb
  • [2024-04-07 05:34:27]
  • 提交

answer

import math

def is_prime(n):
    if n <= 1:
        return False
    if n <= 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i += 6
    return True

def can_starting_player_win(N):
    if N % 2 == 0:
        return True
    else:
        return not is_prime(N)

# Read input
N = int(input())

# Check if the starting player can win
if can_starting_player_win(N):
    print("Y")
else:
    print("N")

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 6ms
memory: 9616kb

input:

10

output:

Y

result:

ok "Y"

Test #2:

score: -100
Wrong Answer
time: 9ms
memory: 9680kb

input:

9

output:

Y

result:

wrong answer 1st words differ - expected: 'N', found: 'Y'