Pagini recente » Cod sursa (job #3192525) | Cod sursa (job #2115403) | Cod sursa (job #1619047) | Cod sursa (job #888521) | Cod sursa (job #863434)
Cod sursa(job #863434)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MOD 10000
#define maxS 44150
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);
if (X > maxS || X < - maxS)
{
printf ("0");
return 0;
}
int LIM = 0;
for (int i = 1; i <= N; ++ i) for (int j = 1; j <= M; ++ j) LIM += i * j;
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 = - LIM; j <= LIM; ++ 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;
}