Cod sursa(job #296576)
Utilizator | Data | 4 aprilie 2009 22:20:14 | |
---|---|---|---|
Problema | Diamant | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<stdio.h>
#include<string.h>
int a[88205],b[88205];
void read()
{
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
if(k>44100 || k<44100)
{
printf("0\n");
return ;
}
int i,j,t;
b[44100]=1;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
{
memcpy(a,b,sizeof(b));
for(t=88200;t>=0;t--)
{
b[t]=a[t-i*j]+a[t]+a[t+i*j];
b[t]%=10000;
}
}
printf("%d\n",b[44100+k]);
}
int main()
{
read();
return 0;
}