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 SQ = 3200;
vector<int> vec;
set<int> ans[SQ];
int n , sz;
void cal(int n){
for(int i = 1 ; i * i <= n ; i++){
if(n % i) continue;
vec.push_back(i);
if(i * i != n) vec.push_back(n / i);
}
}
int main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
ans[0].insert(0);
cin >> n;
cal(n);
sort(vec.begin() , vec.end());
sz = (int)vec.size();
for(int i = 1 ; i < sz ; i++){
for(int j = 0 ; j < i ; j++){
if(vec[i] % vec[j]) continue;
for(auto k : ans[j]) ans[i].insert(vec[i] / vec[j] + k - 1);
}
}
cout << (int)ans[sz - 1].size() << '\n';
for(auto k : ans[sz - 1])
cout << k << ' ';
cout << '\n';
return 0;
}
# | 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... |