Pagini recente » Cod sursa (job #400052) | Cod sursa (job #1250259) | Cod sursa (job #985631) | Cod sursa (job #1274654) | Cod sursa (job #1072974)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
ifstream fin("diamant.in");
ofstream fout("diamant.out");
const int Nmax = 21;
const int Dmax = 901000;
const int Xmax = 44100;
const int MOD = 10000;
unsigned short N, M, X, A[Dmax], B[Dmax];
#define A (A + Xmax)
#define B (B + Xmax)
void Add(short val)
{
for(int i = -Xmax + val; i <= Xmax; i++)
B[i] += A[i - val];
for(int i = -Xmax; i <= Xmax - val; i++)
B[i] += A[i + val];
for(int i = -Xmax; i <= Xmax; i++)
A[i] = (A[i] + B[i]) % MOD, B[i] = 0;
}
int main()
{
fin>>N>>M>>X;
if(X < -Xmax || Xmax < X) {fout<<'0'; return 0;}
A[0] = 1;
for(int i = 1; i <= N; i++)
for(int j = 1; j <= M; j++)
Add(i * j);
fout<<A[X];
return 0;
}