結果

問題 No.2479 Sum of Squares
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-09-22 21:34:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 88,856 KB
最終ジャッジ日時 2023-09-22 21:34:21
合計ジャッジ時間 7,186 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
88,668 KB
testcase_01 AC 204 ms
88,732 KB
testcase_02 AC 203 ms
88,728 KB
testcase_03 AC 208 ms
88,608 KB
testcase_04 AC 215 ms
88,740 KB
testcase_05 AC 213 ms
88,652 KB
testcase_06 AC 216 ms
88,620 KB
testcase_07 AC 213 ms
88,640 KB
testcase_08 AC 203 ms
88,772 KB
testcase_09 AC 219 ms
88,628 KB
testcase_10 AC 209 ms
88,392 KB
testcase_11 AC 205 ms
88,772 KB
testcase_12 AC 204 ms
88,728 KB
testcase_13 AC 204 ms
88,768 KB
testcase_14 AC 207 ms
88,720 KB
testcase_15 AC 215 ms
88,720 KB
testcase_16 AC 213 ms
88,676 KB
testcase_17 AC 211 ms
88,440 KB
testcase_18 AC 208 ms
88,732 KB
testcase_19 AC 214 ms
88,856 KB
testcase_20 AC 217 ms
88,796 KB
testcase_21 AC 208 ms
88,668 KB
testcase_22 AC 206 ms
88,544 KB
testcase_23 AC 205 ms
88,800 KB
testcase_24 AC 208 ms
88,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import decimal,math
S=int(input())
ans=[]
for i in range(15):
    lf=0
    ri=10**10
    while ri-lf>1:
    	mid=(lf+ri)//2
    	if mid**2<=S:
    		lf=mid
    	else:
    		ri=mid
    ans.append(lf**2)
    S-=ans[-1]
    if S==0:
        break
print(len(ans))
print(*ans)
0