Cod sursa(job #300485)
Utilizator | Data | 7 aprilie 2009 14:27:57 | |
---|---|---|---|
Problema | Diamant | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.61 kb |
#include<fstream.h>
#define xx 21
#define max 44100
ifstream fin("diamant.in");
ofstream fout("diamant.out");
int a[2*max+10],b[2*max+10],n,m,k,i,j,t;
int main()
{
fin>>n>>m>>k;
if(k>max)
fout<<"0\n";
else
{
a[max]=1;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
{
memcpy(b,a,sizeof(b));
for(t=2*max;t>=0;t--)
{
a[t]=b[t+i*j]+b[t]+b[t-i*j];
a[t]%=10000;
}
}
fout<<a[k+max]<<'\n';
}
fout.close();
return 0;
}