Submission #248796

#TimeUsernameProblemLanguageResultExecution timeMemory
248796SortingToys (CEOI18_toy)C++14
0 / 100
0 ms384 KiB
#include <bits/stdc++.h> using namespace std; vector<int> ans; void solve(int sum, int n, int last){ ans.push_back(sum + n - 1); for(int i = last; i * i <= n; ++i) if(n % i == 0) solve(sum + i - 1, n / i, i); } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; solve(0, 2, 2); ans.resize(unique(ans.begin(), ans.end()) - ans.begin()); cout << ans.size() << "\n"; for(int x: ans) cout << x << " "; cout << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...