Submission #153178

#TimeUsernameProblemLanguageResultExecution timeMemory
153178nicolaalexandraToys (CEOI18_toy)C++14
59 / 100
2186 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){ v.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 (v.begin(),v.end()); 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; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:26:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=1;i<v.size();i++)
                  ~^~~~~~~~~
#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...