結果
問題 |
No.2479 Sum of Squares
|
ユーザー |
|
提出日時 | 2023-11-29 22:14:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 1,981 ms |
コンパイル使用メモリ | 194,448 KB |
最終ジャッジ日時 | 2025-02-18 02:25:44 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ ll s; cin>>s; vector<ll> ans; while(s){ ll ok=0,ng=1e9+1; while(abs(ok-ng)>1){ ll mid=(ok+ng)/2; if(mid*mid<=s){ ok=mid; }else{ ng=mid; } } s-=ok*ok; ans.push_back(ok*ok); } cout<<ans.size()<<endl; for(ll u:ans){ cout<<u<<" "; } }