Pagini recente » Cod sursa (job #2364704) | Cod sursa (job #2958693) | Cod sursa (job #1276834) | Cod sursa (job #1206061) | Cod sursa (job #1886353)
#include <stdio.h>
using namespace std;
#define IMP 10000
FILE*fin = fopen("diamant.in", "r");
FILE *fout = fopen("diamant.out", "w");
int a[200000];
int b[200000];
int c[200000];
int main()
{
int n,m,k;
fscanf(fin, "%d%d%d", &n, &m, &k);
int smax=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{
smax+=(i*j);
}
a[smax]=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
int s=i*j;
for(int q=0;q<=2*smax;q++)
{
b[q]=a[q]%IMP;
c[q]=a[q]%IMP;
}
for(int q=0;q<=2*smax-s;q++)
{
if(b[q+s]!=0) b[q]+=b[q+s]%IMP;
b[q]%=IMP;
}
for(int q=2*smax;q>=s;q--)
{
if(c[q-s]!=0) c[q]+=c[q-s]%IMP;
c[q]%=IMP;
}
for(int q=0;q<=2*smax;q++)
{
a[q]=b[q]%IMP+c[q]%IMP-a[q]%IMP;
if(a[q]<0)a[q]=IMP+a[q];
a[q]=a[q]%IMP;
}
}
}
if(k>=-smax && k<=smax)fprintf(fout, "%d", a[k+smax]%IMP);
else fprintf(fout, "0");
return 0;
}