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;
typedef long long LL;
set<int> num;
void solve(int n, int x, int l){
if(n == 1){
num.insert(x);
}
for(int a = 1; a * a <= n; a++){
if(n % a == 0){
if(a >= l) solve(n/a, x+a-1, a);
if(n/a >= l) solve(a, x+n/a-1, n/a);
}
}
}
int main(){
int n;
cin >> n;
solve(n, 0, 2);
cout << num.size() << '\n';
for(int x : num){
cout << x << " ";
}
cout << '\n';
}
# | 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... |