Cod sursa(job #459371)

Utilizator cont_de_testeCont Teste cont_de_teste Data 29 mai 2010 14:34:27
Problema 1-sir Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <cstdio>
#include <string>

const char FIN[] = "1-sir.in";
const char FOU[] = "1-sir.out";
const int MOD = 194767;

int N, S, D[1512][1255];

int main()
{
    freopen(FIN, "r", stdin);
    freopen(FOU, "w" ,stdout);

    scanf("%d %d", &N, &S);

    for (int i = 1; i <= N; ++i)
    {
        D[i][0] = 1;
      for (int j = 1; j <= abs(S); ++j)
         D[i][j] = D[i-1][abs(j-(i-1))] + D[i-1][abs(j+(i-1))];
    }

    printf("%d", D[N][S]);

    return 0;
}