結果

問題 No.3236 累乗数大好きbot
ユーザー tkykwtnb
提出日時 2025-08-15 22:38:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,908 KB
実行使用メモリ 78,216 KB
最終ジャッジ日時 2025-08-15 22:38:44
合計ジャッジ時間 8,805 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 2 TLE * 1 -- * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
def prime_factorize(n):
    a=defaultdict(int)
    while n%2==0:n//=2;a[2]+=1
    f=3
    while f*f<=n:
        if n%f==0:n//=f;a[f]+=1
        else:f+=2
    if n!=1:a[n]+=1
    return a

Q=int(input())
for _ in range(Q):
    N=int(input())
    pf=prime_factorize(N)
    orders=set(pf.values())
    if len(orders)==1:
        print(orders.pop())
    else:print(1)
0