Cod sursa(job #181007)
Utilizator | Data | 17 aprilie 2008 19:24:12 | |
---|---|---|---|
Problema | Diamant | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <stdio.h>
#include <iostream>
#define abs( x ) ((x>0)?x: - x)
int n,i,j,t,m,k,x[50000],y[50000];
int main()
{
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
scanf("%d %d %d",&n,&m,&k);
if (abs(k) > 45000) {printf("0\n"); return 0;}
x[0] = 1;
for (i=1;i<=n;++i)
for (j=1;j<=m;++j)
{
memcpy(y, x, sizeof(x));
for (t=0;t<=45000;++t)
x[t]=(y[abs((t-i*j))]+y[t]+y[t+i*j])%10000;
}
printf("%d\n",x[abs(k)]);
return 0;
}