Submission #131135

#TimeUsernameProblemLanguageResultExecution timeMemory
131135VardanyanToys (CEOI18_toy)C++14
59 / 100
5081 ms920 KiB
#include <bits/stdc++.h> using namespace std; set<int> s; void rec(int n,int sm){ if(n == 1){ s.insert(sm); return; } for(int i = 1;i*i<=n;i++){ if(n%i) continue; if(i>1) rec(n/i,sm+i-1); int x = n/i; rec(n/x,sm+x-1); } } int main(){ ios_base::sync_with_stdio(false); int n; cin>>n; rec(n,0); cout<<s.size()<<endl; set<int>::iterator it = s.begin(); for(;it!=s.end();it++){ cout<<*(it)<<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...