Submission #124271

#TimeUsernameProblemLanguageResultExecution timeMemory
124271RafikHachanaToys (CEOI18_toy)C++14
19 / 100
5091 ms380 KiB
#include<bits/stdc++.h> using namespace std; int n; int ma; set<int> s; void f(int r,int p,int sum) { if(r==0) { if(n%p==0) { int x = n/p -1; //cout<<x<<endl; if(x>0) { s.insert(sum+x); } } return; } for(int i=ma+5;i>0;i--) { //v.push_back(i); f(r-1,p*(i+1),sum+i); //v.pop_back(); } } int main() { cin>>n; s.insert(n-1); int r = 2; while(true) { ma= ceil(pow(n,1.0/r)); //cout<<ma<<endl; //cout<<456<<endl; //vector<int> w; f(r-1,1,0); //f(r,w); if(ma<=2) break; r++; } cout<<s.size()<<endl; for(auto it:s) cout<<it<<" "; cout<<endl; }
#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...