Submission #266985

#TimeUsernameProblemLanguageResultExecution timeMemory
266985Anish08Toys (CEOI18_toy)C++14
100 / 100
659 ms4472 KiB
#include<iostream> #include<bits/stdc++.h> using namespace std; int sum{0}; set<int> s; void factor(int n,int div ) { if(n==1)s.insert(sum); else { sum = sum+n-1; s.insert(sum); sum = sum -n+1; for(int k = max(div,2) ; k*k<=n ; k++) { if(n%k == 0) { sum = sum +k-1; factor(n/k , k); sum = sum -k+1; } } } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin>>t; factor(t,1); cout<<s.size()<<endl; for( auto t = s.begin() ; t != s.end();t++) { cout<<*t<<" "; } 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...