結果

問題 No.2725 Coprime Game 2
ユーザー titiatitia
提出日時 2024-04-14 01:55:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 439 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 77,536 KB
最終ジャッジ日時 2024-04-14 01:55:48
合計ジャッジ時間 4,546 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,404 KB
testcase_01 AC 42 ms
53,636 KB
testcase_02 AC 43 ms
52,940 KB
testcase_03 AC 128 ms
76,736 KB
testcase_04 AC 439 ms
76,680 KB
testcase_05 AC 197 ms
77,536 KB
testcase_06 AC 193 ms
76,972 KB
testcase_07 AC 183 ms
77,076 KB
testcase_08 AC 193 ms
77,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from math import gcd

T=int(input())
for tests in range(T):
    N=int(input())

    OK=set()

    for i in range(2,N):
        if N%i!=0:
            OK.add(i)
        if gcd(i,N)==1:
            start=i
            break

    #print(start,OK)

    if N==2 or min(OK)!=start:
        print("P")
    else:
        print("K")

    
0