Submission #228591

#TimeUsernameProblemLanguageResultExecution timeMemory
228591vankataZapina (COCI20_zapina)C++14
0 / 110
5 ms384 KiB
#include<bits/stdc++.h> using namespace std; const int MOD = (int)(1e9+7); long long dp[1024]; int main() { long long n,a,b,c,l,i,j; cin>>n; dp[1]=1; for(i=2;i<=n;i++) { a=1; for(j=2;j<=i;j++)a*=j; for(j=i-1;j>=1;j--) { b=1; for(l=1;l<=j;l++)b*=l; c=1; for(l=1;l<=i-j;l++)c*=l; dp[i]+=(dp[j]*((a/(b*c))%MOD)); dp[i]%=MOD; } dp[i]+=1; dp[i]%=MOD; } cout<<dp[n]<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...