結果

問題 No.2725 Coprime Game 2
ユーザー MasKoaTSMasKoaTS
提出日時 2023-01-22 15:53:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 90,284 KB
最終ジャッジ日時 2023-10-06 00:10:25
合計ジャッジ時間 3,573 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def lcm(x, y):
	return x // gcd(x, y) * y

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

def solve(n):
	l = 1
	for i in range(1, n):
		l = lcm(l, i)
		print(i, l)
		if(n % l != 0):
			return 'K' if(gcd(n, i) == 1) else 'P'
	return 'P'

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