Submission #424734

#TimeUsernameProblemLanguageResultExecution timeMemory
424734Rouge_HugoToys (CEOI18_toy)C++14
19 / 100
2 ms1740 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back using namespace std; int n;const int N=10090; int y[N],vis[N][N];vector<int>v,vv; void d(int sum,int p) { if(sum>n)return ; if(p>n)return ; if(vis[sum][p])return; vis[sum][p]=1; if(p==1) { y[sum]=1;return; } for(auto it:v) { if(p%it)continue; d(sum+it-1,p/it); } } int main() { cin>>n; for(int i=2;i<=n;i++) { if(n%i)continue; v.pb(i); } d(0,n); for(int i=0;i<=50;i++) { if(y[i])vv.pb(i); } cout<<vv.size()<<endl; for(auto it:vv)cout<<it<<" "; }
#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...