Submission #96394

#TimeUsernameProblemLanguageResultExecution timeMemory
96394easruiToys (CEOI18_toy)C++14
100 / 100
833 ms4496 KiB
#include <bits/stdc++.h> using namespace std; int N; set<int> S; void act(int cur, int val, int sum) { if(val>=cur) S.insert(sum+cur-1); if(cur==1) return; for(int i=2; i<=min(val,cur/i); i++){ if(cur%i) continue; if(i<=val) act(cur/i,i,sum+i-1); if(cur/i<=val) act(i,cur/i,sum+cur/i-1); } } int main() { ios_base::sync_with_stdio(0),cin.tie(0); cin >> N; act(N,N,0); cout << S.size() << '\n'; for(auto it : S) 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...