Pagini recente » Cod sursa (job #785078) | Cod sursa (job #1780082) | Cod sursa (job #2500169) | Cod sursa (job #194375) | Cod sursa (job #863421)
Cod sursa(job #863421)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MOD 10000
#define maxS 100000
int DP[3][2 * (maxS + 5)];
int main()
{
freopen ("diamant.in", "r", stdin);
freopen ("diamant.out", "w", stdout);
int N, M, X;
scanf ("%d %d %d", &N, &M, &X);
DP[0][maxS] = 1;
int t = 1;
for (int x = 1; x <= N; ++ x)
for (int y = 1; y <= M; ++ y)
{
int l = t % 2;
for (int j = - maxS; j < maxS; ++ j)
{
DP[l][j + maxS] = 0;
if (j - x * y >= - maxS) DP[l][j + maxS] += DP[!l][j - x * y + maxS];
DP[l][j + maxS] += DP[!l][j + maxS];
if (j + x * y <= 2 * maxS) DP[l][j + maxS] += DP[!l][j + x * y + maxS];
DP[l][j + maxS] %= MOD;
}
++ t;
}
printf ("%d", DP[(N * M) % 2][X + maxS]);
return 0;
}