結果
問題 |
No.2479 Sum of Squares
|
ユーザー |
|
提出日時 | 2023-09-22 21:45:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,645 ms / 2,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 1,329 ms |
コンパイル使用メモリ | 169,768 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-08 12:30:26 |
合計ジャッジ時間 | 11,997 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #include <math.h> //ここから省略 #define yes (cout<<"Yes"<<endl) #define no (cout<<"No"<<endl) using namespace std; int main(){ long long n,a;cin>>n; vector<long long> b;a=sqrt(n); for(long long i=a;i>0;i--){ while(n>=i*i){ b.push_back(i*i); n-=i*i; } if(n==0)break; //cout<<i<<':'<<n<<endl; } cout<<b.size()<<endl; for(long long x:b)cout<<x<<' '; cout<<endl; }