Submission #228591

# Submission time Handle Problem Language Result Execution time Memory
228591 2020-05-01T19:37:31 Z vankata Zapina (COCI20_zapina) C++14
0 / 110
5 ms 384 KB
#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 time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -