結果

問題 No.2721 "Don't say N" Game
ユーザー MasKoaTSMasKoaTS
提出日時 2023-10-05 22:44:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 76,304 KB
最終ジャッジ日時 2023-10-05 22:44:32
合計ジャッジ時間 1,604 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,216 KB
testcase_01 AC 93 ms
76,160 KB
testcase_02 AC 89 ms
76,212 KB
testcase_03 AC 85 ms
75,716 KB
testcase_04 AC 82 ms
75,644 KB
testcase_05 AC 86 ms
76,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def isqrt(n):
    ok = 0
    ng = 32
    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