Submission #424725

#TimeUsernameProblemLanguageResultExecution timeMemory
424725Rouge_HugoToys (CEOI18_toy)C++14
19 / 100
1 ms460 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=100; 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==n) { y[sum]=1;return; } for(auto it:v) { 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,1); 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...