結果

問題 No.2721 "Don't say N" Game
ユーザー MasKoaTSMasKoaTS
提出日時 2023-09-24 23:40:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 76,280 KB
最終ジャッジ日時 2023-10-05 22:29:09
合計ジャッジ時間 1,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,220 KB
testcase_01 AC 90 ms
75,992 KB
testcase_02 AC 90 ms
76,104 KB
testcase_03 AC 88 ms
76,280 KB
testcase_04 AC 83 ms
75,664 KB
testcase_05 AC 87 ms
76,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def isqrt(n):
    ok = 0
    ng = 10 ** 9 + 1
    while(abs(ok - ng) > 1):
        mid = (ok + ng) >> 1
        if(mid ** 2 <= n):
            ok = mid
        else:
            ng = mid
    return ok


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

for n in query:
    if(isqrt(n) ** 2 == n):
        print('P')
    else:
        print('K')
0