結果

問題 No.2479 Sum of Squares
ユーザー ronpooronpoo
提出日時 2023-10-25 10:30:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-09-25 05:31:15
合計ジャッジ時間 2,499 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

S = int(input())

s = S
ans = []
while s > 0:
    l = 1
    r = s
    while r - l > 1:
        m = (l + r) // 2
        if m**2 <= s:
            l = m
        else:
            r = m            
    p = l
    s -= p**2
    ans.append(p**2)

print(len(ans))
print(*ans, sep=' ')
0