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>
#define ll int
using namespace std;
ll n,i,j,m,x,y;
vector<ll> a;
set<ll> s[2000],t;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for(i=1;i*i<=n;i++){
if(n%i!=0) continue;
if(i*i==n){
a.push_back(i);
continue;
}
a.push_back(i);
a.push_back(n/i);
}
sort(a.begin(),a.end());
m=a.size();
s[0].insert(0);
for(i=0;i<m;i++){
x=a[i];
for(j=i+1;j<m;j++){
y=a[j];
if(y%x!=0) continue;
ll add=y/x-1;
for(ll l:s[i]) s[j].insert(l+add);
}
}
cout << s[m-1].size() << "\n";
for(ll i:s[m-1]) cout << i << " ";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |