結果
| 問題 | No.2479 Sum of Squares |
| コンテスト | |
| ユーザー |
koheijkt
|
| 提出日時 | 2026-05-06 17:36:30 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 363 bytes |
| 記録 | |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2026-05-06 17:36:39 |
| 合計ジャッジ時間 | 8,173 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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