結果

問題 No.2725 Coprime Game 2
ユーザー MasKoaTSMasKoaTS
提出日時 2023-03-02 18:48:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 79,444 KB
最終ジャッジ日時 2023-10-06 00:10:20
合計ジャッジ時間 2,358 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,380 KB
testcase_01 AC 75 ms
71,480 KB
testcase_02 AC 76 ms
71,176 KB
testcase_03 AC 140 ms
79,100 KB
testcase_04 AC 181 ms
79,284 KB
testcase_05 AC 178 ms
79,444 KB
testcase_06 AC 158 ms
79,284 KB
testcase_07 AC 146 ms
78,416 KB
testcase_08 AC 169 ms
79,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import gcd
input = sys.stdin.readline

query = [int(input()) for _ in [0] * int(input())]

def solve(n):
	for i in range(2, n):
		if(n % i == 0):
			continue
		if(gcd(n, i) == 1):
			return 'K'
		else:
			break
	return 'P'

for n in query:
	print(solve(n))
0