# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
380358 | 2021-03-21T06:34:01 Z | YJU | Toys (CEOI18_toy) | C++14 | 0 ms | 0 KB |
#include<bits/stdc++.h> #pragma GCC optimzie("unroll-loops,no-stack-prorector,Ofast") using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef long double ld; typedef complex<ld> cpx; const ll N=2e5+5; const ll MOD=1e9+7; const ld pi=acos(-1); const ll INF=(1LL<<60); #define REP(i,n) for(int i=0;i<n;i++) #define REP1(i,n) for(int i=1;i<=n;i++) #define pb push_back #define mp make_pair #define X first #define Y second #define lwb lower_bound #define ALL(_a) _a.begin(),_a.end() #define SZ(_a) (ll)_a.size() ll n; vector<ll> lis; ] void split(ll k){ for(int i=1;i*i<=k;i++){ if(k%i==0){ lis.pb(n/k-1+i-1+k/i-1); } } } int main(){ ios_base::sync_with_stdio(0);cin.tie(0); cin>>n; for(int i=1;i*i<=n;i++){ if(n%i==0){ split(i); split(n/i); } } sort(lis.begin(),lis.end()); lis.erase(unique(ALL(lis)),lis.end()); cout<<SZ(lis)<<"\n"; REP(i,SZ(lis))cout<<lis[i]<<" \n"[i==SZ(lis)-1]; return 0; }