結果
| 問題 | No.2479 Sum of Squares |
| コンテスト | |
| ユーザー |
koheijkt
|
| 提出日時 | 2026-05-06 17:36:30 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 25 ms / 2,000 ms |
| + 523µs | |
| コード長 | 363 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 81,552 KB |
| 実行使用メモリ | 56,016 KB |
| 最終ジャッジ日時 | 2026-09-19 17:13:16 |
| 合計ジャッジ時間 | 2,333 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
S = int(input())
# k 乗根
def sqrt(n: int, k = 2):
l = k - 1
if not n: return 0
y = 1 << (n.bit_length() + l) // k
x = y + 1
while y < x:
x = y
y = (l * x + n // (x ** l)) // k
return x
def f(n: int):
if n == 0:
return []
x = sqrt(n)
return [x*x] + f(n - x*x)
ans = f(S)
print(len(ans))
print(*ans)
koheijkt