結果

問題 No.2479 Sum of Squares
ユーザー GrayCoder
提出日時 2023-09-23 20:49:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-07-16 20:40:51
合計ジャッジ時間 2,244 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import *
import math
import sys


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

    ans, n = [], S
    while n > 0:
        x = math.floor(Decimal(str(n)) ** Decimal("0.5")) ** 2
        ans.append(x)
        n -= x
    print(len(ans))
    print(*ans)


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

main()
0