Submission #153180

#TimeUsernameProblemLanguageResultExecution timeMemory
153180nicolaalexandraToys (CEOI18_toy)C++14
59 / 100
2175 ms262148 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; //ifstream cin ("date.in"); //ofstream cout ("date.out"); vector <int> sol,v; int x,nr,d; void back (int x, int val){ sol.push_back(x+val-1); /// vreau sa maresc nr de factori cu 1 for (int d=2;d<=x/d;d++) if (x % d == 0) back (x/d,val+d-1); } int main (){ cin>>x; back (x,0); sort (sol.begin(),sol.end()); sol.resize(unique(sol.begin(),sol.end())-sol.begin()); /* sort (v.begin(),v.end()); if (v.size()) sol.push_back(v[0]); for (int i=1;i<v.size();i++) if (v[i] != v[i-1]) sol.push_back(v[i]); */ cout<<sol.size()<<"\n"; for (auto x:sol) cout<<x<<" "; return 0; }
#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...