結果
| 問題 | No.3776 Magic Square of Product |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-23 21:58:16 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,219 ms / 2,500 ms |
| + 220µs | |
| コード長 | 681 bytes |
| 記録 | |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 64,788 KB |
| 実行使用メモリ | 211,236 KB |
| 最終ジャッジ日時 | 2026-10-23 21:59:07 |
| 合計ジャッジ時間 | 33,504 ms |
|
ジャッジサーバーID (参考情報) |
judge6_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
ソースコード
from collections import Counter
x = 10 ** 6
factor = [[i] for i in range(x + 1)]
for i in range(2, x + 1):
if len(factor[i]) != 1: continue
k = 2
while i * k <= x:
value = factor[i * k].pop()
while value % i == 0:
factor[i * k].append(i)
value //= i
if value != 1:
factor[i * k].append(value)
k += 1
def f(x):
return x * (x + 1) * (x ** 2 + x + 2) // 8
T = int(input())
def solve():
K = int(input())
if K == 1:
print(1)
return
c = Counter(factor[K])
ans = 1
for p in c.keys():
ans *= f(c[p] + 1)
print(ans)
for _ in range(T):
solve()