結果

問題 No.2725 Coprime Game 2
ユーザー yu_w(ゆ)yu_w(ゆ)
提出日時 2024-04-12 23:23:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 349 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 77,040 KB
最終ジャッジ日時 2024-04-12 23:23:59
合計ジャッジ時間 3,327 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,320 KB
testcase_01 AC 36 ms
52,808 KB
testcase_02 AC 38 ms
53,340 KB
testcase_03 AC 284 ms
76,648 KB
testcase_04 AC 349 ms
76,348 KB
testcase_05 AC 339 ms
77,040 KB
testcase_06 AC 332 ms
76,760 KB
testcase_07 AC 241 ms
76,992 KB
testcase_08 AC 336 ms
76,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
for _ in range(int(input())):
    N=int(input())
    Ncopy = N

    LoseNum = 2
    for i in range(2,min(N,1000)):
        isLosenum = True
        if N%i == 0:
            isLosenum = False
        if isLosenum:
            LoseNum = i
            break

    if math.gcd(Ncopy,LoseNum) != 1:
        print("P")
    else:
        print("K")
0