Submission #579156

#TimeUsernameProblemLanguageResultExecution timeMemory
579156webToys (CEOI18_toy)C++17
59 / 100
5048 ms808 KiB
#include <iostream> #include <vector> #include <string> #include <set> #include <math.h> using namespace std; set<long long> numToys; void recursiveCalc( long long n, long long numUsedAlready) { if(n==1) { numToys.insert(numUsedAlready); return; } if(n>1) numToys.insert(numUsedAlready+(n-1)); for(int i = 1; i<=ceil(sqrt(n));++i) { if(n%(i+1) == 0) { recursiveCalc( n/(i+1), numUsedAlready + i); } } } int main() { long long n; cin>>n; recursiveCalc( n, 0); cout<<numToys.size()<<endl; for(auto el:numToys) cout<<el<<" "; cout<<endl; 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...