Submission #677927

#TimeUsernameProblemLanguageResultExecution timeMemory
677927Ahmed57Toys (CEOI18_toy)C++14
100 / 100
1802 ms4376 KiB
#include <bits/stdc++.h> using namespace std; //DSU set<int> ans; void sum(int x,int su,int last){ if(x==1){ ans.insert(su); return; } for(long long i = 1;i*i<=x;i++){ if(x%i==0){ if(i!=1&&i>=last)sum(x/i , su+(i-1) , i); if(x/i!=i){ if(x/i>=last)sum(x/(x/i) , su+((x/i)-1) , x/i); } } } } int main(){ //freopen("poklonin6.txt","r",stdin); long long n; cin>>n; sum(n,0,0); cout<<ans.size()<<"\n"; for(auto i:ans)cout<<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...