Pagini recente » Cod sursa (job #1057456) | Cod sursa (job #441387) | Cod sursa (job #1866743) | Cod sursa (job #2571471) | Cod sursa (job #2137333)
#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;
++dr[0][v[k]];
}
int x = N*(N+1)/2;
int y = M*(M+1)/2;
int l = 1;
for(int i=1; i<=N*M; ++i)
{
for(int j=v[i]; j<=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][X]%mod;
return 0;
}