結果

問題 No.2721 "Don't say N" Game
ユーザー 16171617
提出日時 2024-04-16 14:36:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-16 14:36:32
合計ジャッジ時間 823 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 40 ms
10,880 KB
testcase_02 AC 39 ms
10,880 KB
testcase_03 AC 44 ms
10,752 KB
testcase_04 AC 35 ms
10,752 KB
testcase_05 AC 40 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def sympy(N):
    """Nの正の約数の数を返す"""
    ans = 0
    if N == 1:
        return 1
    now = 1
    while now <= math.sqrt(N):
        if N%now == 0:
            if now == math.sqrt(N):
                ans += 1
            else:
                ans += 2
        
        now += 1
    return ans
#for k in range(1, 10):
#    print(k, sympy(k))
T = int(input())
for t in range(T):
    N = int(input())
    turn_needed = sympy(N)
    if turn_needed%2 == 1:
        print("P")
    else:
        print("K")


0