Pagini recente » Cod sursa (job #1918609) | Cod sursa (job #1089756) | Cod sursa (job #1415752) | Cod sursa (job #2090781) | Cod sursa (job #420863)
Cod sursa(job #420863)
#include <cstdio>
using namespace std;
#define MOD 10000
#define NMAX 44100
#define NTOT 88240
int C[NTOT],C2[NTOT];
int main()
{
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
int n,m,X,i,j,h,stot,smax;
scanf("%d %d %d",&n,&m,&X);
smax=(n*(n+1)/2)*(m*(m+1)/2);
if (X>smax || X<-smax) { printf("0\n"); return 0;}
stot=smax*2+2;
C2[smax]=1; //0
for (i=1;i<=n;++i)
for (j=1;j<=m;++j)
{
for (h=0;h<=stot;++h) C[h]=C2[h];
int p=i*j;
for (h=0;h<=stot;++h)
if (C[h])
{
C2[h+p]+=C[h];
if (C2[h+p]>MOD) C2[h+p]-=MOD;
C2[h-p]+=C[h];
if (C2[h-p]>MOD) C2[h-p]-=MOD;
}
}
printf("%d",C2[X+smax]);
return 0;
}