Pagini recente » Cod sursa (job #1937272) | Cod sursa (job #645633) | Cod sursa (job #3154753) | Cod sursa (job #1519600) | Cod sursa (job #2137346)
#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;
dr[l][j]=dr[l][j]%mod;
}
l=1-l;
}
fout << dr[1-l][X]%mod;
return 0;
}