結果

問題 No.2721 "Don't say N" Game
ユーザー 1617
提出日時 2024-04-16 14:36:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-07 10:51:31
合計ジャッジ時間 886 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

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