結果
問題 | No.300 平方数 |
ユーザー |
![]() |
提出日時 | 2020-02-06 22:53:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 126 ms / 1,000 ms |
コード長 | 663 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-25 06:56:38 |
合計ジャッジ時間 | 3,603 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) def II(): return int(sys.stdin.readline()) def PrimeFactorization(x): def plist(x): if x < 2: return [] if x & 1 == 0: return [2] + plist(x // 2) for p in range(3, x + 1, 2): if x % p == 0: return [p] + plist(x // p) if p ** 2 > x: return [x] pl = plist(x) pp, ee = [], [] for p in pl: if not pp or p != pp[-1]: pp += [p] ee += [0] ee[-1] += 1 return [(p, e) for p, e in zip(pp, ee)] def main(): x=II() pe=PrimeFactorization(x) ans=1 for p,e in pe: if e%2:ans*=p print(ans) main()