結果

問題 No.2479 Sum of Squares
ユーザー miho-4
提出日時 2023-09-22 21:46:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 275 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,504 KB
最終ジャッジ日時 2024-07-08 12:31:13
合計ジャッジ時間 6,646 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1 -- * 2
other -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ans=[]

while 0<n:
  l,r=1,n
  while l<r:
    m=(l+r)//2
    if m**2<=n:
      if n<(m+1)**2:
        while m*m<=n:
          n-=m*m
          ans.append(m*m)
          l=10**10
      else:
        l=m+1
    else:
      r=m-1
      
print(len(ans))
print(*ans)
0