Submission #537340

#TimeUsernameProblemLanguageResultExecution timeMemory
537340Hydroxic_AcidToys (CEOI18_toy)C++17
0 / 100
214 ms262144 KiB
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <set> using namespace std; int n; vector<int> v; set<int> ans; void dp(int N, int i, int summ){ if(N == 1){ ans.insert(summ); return; } for(int x = 0; x < (int)v.size(); x++){ if(v[x] >= i && N % v[x] == 0){ dp(N / v[x], v[x], summ + v[x] - 1); } } } signed main(){ cin >> n; int f = 1; while(f <= (int)sqrt(n) + 1){ if(n % f == 0){ if(f != 1) v.push_back(f); if(n/f != f) v.push_back(n/f); } f++; } dp(n, 0, 0); cout << (int)ans.size() << "\n"; for(set<int>::iterator it = ans.begin(); it != ans.end(); it++){ cout << (*it) << " "; } }
#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...