結果

問題 No.2479 Sum of Squares
ユーザー GrayCoderGrayCoder
提出日時 2023-09-22 22:24:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 392 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-08 13:10:05
合計ジャッジ時間 1,844 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def main():
    input = lambda: sys.stdin.readline()[:-1]
    S = int(input())

    ans, n = [], S
    while 1:
        if sum(ans) == S:
            break
        x = int(n**0.5) ** 2
        ans.append(x)
        n -= x

    if sum(ans) != S:
        ans.append(1)
    print(len(ans))
    print(*ans)


if not __debug__:
    f = open(sys.argv[1], "r")
    sys.stdin = f

main()
0