Pagini recente » Cod sursa (job #738873) | Cod sursa (job #1518183) | Cod sursa (job #521132) | Cod sursa (job #2667136) | Cod sursa (job #448384)
Cod sursa(job #448384)
#include <cstdio>
#include <string>
const char FIN[] = "diamant.in";
const char FOU[] = "diamant.out";
const int MOD = 10000;
const int MAX = 1 << 16;
int M, N, X;
int i, j, g;
int V[MAX], AUX[MAX];
int main()
{
freopen(FIN, "r", stdin);
freopen(FOU, "w", stdout);
scanf("%d %d %d", &M, &N, &X);
int limit = N * M * (N + 1) * (M + 1) >> 2;
if ((X = abs(X)) > limit)
printf("0");
else
{
V[0] = 1;
for (i = 1; i <= M ; ++i)
for (j = 1; j <= N; ++j)
{
for (g = 0; g <= limit; ++g)
AUX[g] = V[ abs( g - i * j ) ] + V[ g ] + V[ g + i * j ], AUX[g] %= MOD;
memcpy(V , AUX , sizeof(AUX));
}
printf("%d", V[X] % MOD);
}
return 0;
}