結果

問題 No.2479 Sum of Squares
ユーザー naesiranaesira
提出日時 2023-09-22 21:34:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 71,312 KB
最終ジャッジ日時 2023-09-22 21:34:13
合計ジャッジ時間 3,454 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
70,780 KB
testcase_01 AC 68 ms
71,144 KB
testcase_02 AC 67 ms
71,252 KB
testcase_03 AC 67 ms
71,304 KB
testcase_04 AC 68 ms
70,776 KB
testcase_05 AC 68 ms
70,984 KB
testcase_06 AC 69 ms
71,136 KB
testcase_07 AC 70 ms
70,776 KB
testcase_08 AC 69 ms
70,952 KB
testcase_09 AC 67 ms
71,280 KB
testcase_10 AC 68 ms
71,020 KB
testcase_11 AC 73 ms
71,168 KB
testcase_12 AC 67 ms
71,220 KB
testcase_13 AC 67 ms
71,156 KB
testcase_14 AC 68 ms
71,168 KB
testcase_15 AC 69 ms
71,168 KB
testcase_16 AC 69 ms
71,248 KB
testcase_17 AC 69 ms
71,312 KB
testcase_18 AC 70 ms
71,308 KB
testcase_19 AC 69 ms
71,004 KB
testcase_20 AC 68 ms
71,156 KB
testcase_21 AC 68 ms
70,956 KB
testcase_22 AC 68 ms
71,056 KB
testcase_23 AC 68 ms
71,276 KB
testcase_24 AC 67 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def bis(ok, ng):
  def is_ok(md):
    return md**2 <= S
  while abs(ok - ng) > 1:
    md = (ng + ok) // 2
    if is_ok(md): ok = md
    else: ng = md
  return ok

S = int(input())
A = []
while S:
  a = bis(1, 10**9+1)
  A.append(a**2)
  S -= a**2
print(len(A))
print(*A)
0