Submission #784551

#TimeUsernameProblemLanguageResultExecution timeMemory
784551Trisanu_DasToys (CEOI18_toy)C++17
100 / 100
647 ms4380 KiB
#include <bits/stdc++.h> using namespace std; set<int> ans; void res(int n, int last, int sum) { ans.insert(sum + n - 1); for(int i = last; i <= n / i; i++) if (n % i == 0) res(n / i, i, sum + i - 1); } int main() { int n; cin >> n; res(n, 2, 0); 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...