Pagini recente » Cod sursa (job #308574) | Cod sursa (job #860683) | Cod sursa (job #2117602) | Cod sursa (job #1311889) | Cod sursa (job #557646)
Cod sursa(job #557646)
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<deque>
#include<queue>
#include<set>
#include<vector>
using namespace std;
const char IN[] = {"diamant.in"};
const char OUT[] = {"diamant.out"};
const int INF = 1000000005;
const double PI = 3.14159265;
const int NMAX = 20;
const int VALMAX = 44100;
const int MOD = 10000;
#define II inline
#define LL long long
#define PII pair<int, int>
#define PDD pair<double, double>
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define FOR(i, a, b) for(int i = a ; i <= b ; i++)
#define IFOR(i, a, b) for(int i = a ; i >= b ; i--)
#define FORIT(it, V) for(vector<int> :: iterator it = V.begin() ; it != V.end() ; it++)
#define all(a) a, a +
int N, M, X;
int a[2*VALMAX + 5];
void citi()
{
scanf("%d%d%d", &N, &M, &X);
}
inline bool in(int x)
{
return(1 <=x && x <= 2*VALMAX);
}
void dinamic()
{
int b[2*VALMAX + 5];
a[VALMAX] = 1;
FOR(i, 1, N)
FOR(j, 1, M)
{
fill(b, b + 2*VALMAX + 5, 0);
FOR(k, 0, 2*VALMAX)
{
if(in(k - i*j)) b[k - i*j] = (b[k - i*j] + a[k])%MOD;
b[k] = (b[k] + a[k])%MOD;
if(in(k + i*j)) b[k + i*j] = (b[k + i*j] + a[k])%MOD;
}
copy(b, b + 2*VALMAX + 5, a);
}
}
void scrie()
{
/*if(X > VALMAX)
{
printf("0");
return;
}*/
printf("%d\n", a[VALMAX + X]);
}
int main()
{
freopen(IN, "r", stdin);
freopen(OUT, "w", stdout);
citi();
dinamic();
scrie();
return 0;
}