結果
| 問題 | No.2479 Sum of Squares |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-22 22:07:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 360 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 51,968 KB |
| 最終ジャッジ日時 | 2024-07-08 12:51:23 |
| 合計ジャッジ時間 | 2,005 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
import sys
input = sys.stdin.readline
def isqrt(n):
if n == 0: return 0
x = 1 << (n.bit_length() + 1) // 2
y = (x + n // x) // 2
while y < x:
x = y
y = (x + n // x) // 2
return x
S = int(input())
ans = []
now = S
while now!=0:
tmp = isqrt(now)
ans.append(tmp**2)
now -= tmp**2
print(len(ans))
print(*ans)