# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385640 | igzi | Toys (CEOI18_toy) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long n,k,r,i,j,a[200],b[200],p,m;
vector <pair<long long,long long>> v;
vector <long long> s;
vector <long long> solve(int n,int p){
vector <long long> ans,tmp;
if(p>n) return ans;
for(int i=p;i*i<=n;i++){
if(n%i) continue;
tmp=solve(n/i,i);
for(int j=0;j<tmp.size();j++){
ans.push_back(tmp[j]+i-1);
}
}
ans.push_back(n-1);
}
int main() {
cin>>n;
if(n==1){
cout<<1<<endl<<0;
return 0;
}
s=(resi(n,2));
sort(s.begin(),s.end());
r=1;
for(i=1;i<s.size();i++){
if(s[i]!=s[i-1]) r++;
}
cout<<r<<endl;
cout<<s[0]<<" ";
for(i=1;i<s.size();i++){
if(s[i]!=s[i-1]) cout<<s[i]<<" ";
}
return 0;
}