Pagini recente » Cod sursa (job #2980659) | Cod sursa (job #1475841) | Cod sursa (job #1616317) | Cod sursa (job #598729) | Cod sursa (job #2137363)
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("diamant.in");
ofstream fout("diamant.out");
const int mod = 10000;
const int clc = 99999;
int N, M, k, X;
int v[405];
int dr[2][clc];
int main()
{
fin >> N >> M >> X;
for(int i=1; i<=N; ++i)
for(int j=1; j<=M; ++j)
{
v[++k] = i*j;
}
int x = N*(N+1)/2;
int y = M*(M+1)/2;
int l = 1;
dr[0][x*y]=1;
for(int i=1; i<=N*M; ++i)
{
for(int j=v[i]; j<=2*x*y-v[i]; ++j)
{
dr[l][j] += (dr[1-l][j-v[i]]%mod+dr[1-l][j+v[i]]%mod)%mod;
dr[l][j]=dr[l][j]%mod;
}
l=1-l;
}
fout << dr[1-l][X+x*y]%mod;
return 0;
}