Cod sursa(job #296580)
Utilizator | Mihai Gheorghe GheorgheMihai | Data | 4 aprilie 2009 22:24:20 |
---|---|---|---|
Problema | Diamant | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 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);
int i,j,t;
b[40000]=1;
if(k<41000)
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
{
memcpy(a,b,sizeof(b));
for(t=82000;t>=0;t--)
{
b[t]=a[t-i*j]+a[t]+a[t+i*j];
b[t]%=10000;
}
}
else
k=1;
printf("%d\n",b[40000+k]);
}
int main()
{
read();
return 0;
}