Pagini recente » Cod sursa (job #684455) | Cod sursa (job #169505) | Cod sursa (job #2541152) | Cod sursa (job #2929952) | Cod sursa (job #2514663)
#include <fstream>
#include <iostream>
#define mod 10000
using namespace std;
ifstream fin("diamant.in");
ofstream fout("diamant.out");
int dp[2][88205], n,m , x;
void solve() {
///dp[i][j] = nr de matrice verificate pana la al i-lea patratel cu valoarea j-44100(val maxima)
dp[0][44100] = 1;
for(int i = 1; i <= n*m; i++)
for(int j = 0; j <= 88200; j++) {
int a = (i-1)/m+1;
int b = i-(a-1)*m;
int val = a*b;
dp[i%2][j] = dp[1-i%2][j];
if(j >= val)
dp[i%2][j] += dp[1-i%2][j-val];
if(j+val<= 88200)
dp[i%2][j] += dp[1-i%2][j+val];
dp[i%2][j] %= mod;
}
fout << dp[(n*m)%2][x+44100];
}
int main() {
fin >> n >> m >> x;
if(x >= -44100 && x <= 44100)
solve();
else
fout << 0;
}