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;
const int MAX = 1e5;
int N,tmp,fac[MAX],num[MAX],selA[MAX],selB[MAX],posA,posB,cnt,res,ans,A,B,C;
vector<int> pows[MAX];
set<int> S;
bool isP[MAX];
void act(int cur, int val, int sum)
{
if(val>=cur) S.insert(sum+cur-1);
if(cur==1) return;
for(int i=2; i<=min(val,cur/i); i++){
if(cur%i) continue;
if(i<=val) act(cur/i,i,sum+i-1);
if(cur/i<=val) act(i,cur/i,sum+cur/i-1);
}
}
int main()
{
ios_base::sync_with_stdio(0),cin.tie(0);
cin >> N;
act(N,N,0);
cout << S.size() << '\n';
for(auto it : S) cout << it << ' ';
}
# | 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... |