結果

問題 No.2479 Sum of Squares
ユーザー mymelochanmymelochan
提出日時 2023-09-22 21:23:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 1,213 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 72,156 KB
最終ジャッジ日時 2023-09-22 21:23:40
合計ジャッジ時間 4,479 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,956 KB
testcase_01 AC 96 ms
71,800 KB
testcase_02 AC 97 ms
71,780 KB
testcase_03 AC 95 ms
71,884 KB
testcase_04 AC 98 ms
71,832 KB
testcase_05 AC 96 ms
71,960 KB
testcase_06 AC 95 ms
72,004 KB
testcase_07 AC 103 ms
71,756 KB
testcase_08 AC 99 ms
71,724 KB
testcase_09 AC 94 ms
72,156 KB
testcase_10 AC 94 ms
72,052 KB
testcase_11 AC 97 ms
71,948 KB
testcase_12 AC 95 ms
71,984 KB
testcase_13 AC 98 ms
72,060 KB
testcase_14 AC 96 ms
71,796 KB
testcase_15 AC 96 ms
71,884 KB
testcase_16 AC 96 ms
71,948 KB
testcase_17 AC 104 ms
71,888 KB
testcase_18 AC 97 ms
71,884 KB
testcase_19 AC 96 ms
71,816 KB
testcase_20 AC 98 ms
71,908 KB
testcase_21 AC 96 ms
71,884 KB
testcase_22 AC 98 ms
72,052 KB
testcase_23 AC 97 ms
71,988 KB
testcase_24 AC 96 ms
71,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################

S = iin()
ans = []
while S:
    t = int(S**0.5)
    for i in range(t+2,t-3,-1):
        if i**2 <= S:
            ans.append(i**2)
            S -= i**2
            break

print(len(ans))
print(*ans)
0