Submission #1006036

#TimeUsernameProblemLanguageResultExecution timeMemory
100603612345678Toys (CEOI18_toy)C++17
100 / 100
994 ms6028 KiB
#include <bits/stdc++.h> using namespace std; int n; set<int> solve(int mn, int vl) { set<int> t; for (int i=mn; (i+1)*(i+1)<=vl; i++) { if ((vl%(i+1))!=0) continue; set<int> a=solve(i, vl/(i+1)); for (auto x:a) t.insert(x+i); } t.insert(vl-1); return t; } int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; auto tmp=solve(1, n); cout<<tmp.size()<<'\n'; for (auto x:tmp) cout<<x<<' '; }
#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...