Cod sursa(job #636045)

Utilizator a_h1926Heidelbacher Andrei a_h1926 Data 19 noiembrie 2011 16:35:49
Problema Dirichlet Scor 8
Compilator cpp Status done
Runda .com 2011 Marime 0.59 kb
#include <cstdio>

#define Mod 9999991
#define NMax 1005

using namespace std;

long long N, S, DP[NMax][NMax];

int main()
{
    freopen ("dirichlet.in", "r", stdin);
    freopen ("dirichlet.out", "w", stdout);
    scanf ("%lld", &N);
    for (int i=0; i<=N; ++i)
    {
        DP[N][i]=1;
    }
    for (int i=N-1; i>0; --i)
    {
        for (int j=N; j>=i; --j)
        {
            DP[i][j]=DP[i][j+1]+DP[i+1][j];
        }
        for (int j=i-1; j>=0; --j)
        {
            DP[i][j]=DP[i][j+1];
        }
    }
    printf ("%lld\n", DP[1][1]);
    return 0;
}