結果
問題 | No.2479 Sum of Squares |
ユーザー |
![]() |
提出日時 | 2023-09-22 21:21:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 327 bytes |
コンパイル時間 | 583 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-07-08 11:58:45 |
合計ジャッジ時間 | 1,937 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
from sys import stdin input=lambda :stdin.readline()[:-1] S=int(input()) def floor_sqrt(n): if n<0: return -1 ng,ok=n+1,-1 while ng-ok>1: mid=(ok+ng)//2 if mid*mid<=n: ok=mid else: ng=mid return ok ans=[] while S>0: x=floor_sqrt(S) ans.append(x*x) S-=x*x print(len(ans)) print(*ans)