結果

問題 No.2721 "Don't say N" Game
コンテスト
ユーザー prin_kemkem
提出日時 2024-04-12 21:23:00
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 79 ms / 2,000 ms
+ 885µs
コード長 874 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 248 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 88,704 KB
最終ジャッジ日時 2026-09-09 06:53:30
合計ジャッジ時間 1,673 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict, deque, Counter
from functools import cache
# import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint, shuffle
import sys
# sys.setrecursionlimit(200000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)

#################################################    

def factor(x):
    retm, retM = [], []
    i = 1
    while i*i <= x:
        if x%i == 0:
            retm.append(i)
            if x//i != i:
                retM.append(x//i)
        i += 1
    return retm+retM[::-1]

T = int(input())
for _ in range(T):
    N = int(input())
    print("P" if len(factor(N))%2 == 1 else "K")
0