Cod sursa(job #293499)

Utilizator RobytzzaIonescu Robert Marius Robytzza Data 1 aprilie 2009 21:13:18
Problema Diamant Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <stdio.h>
#include <string.h>

using namespace std;

int An[83000];
int Bn[83000];
int i,j,n,m,k;


int main()
{
	freopen ("diamant.in","r",stdin);
	freopen ("diamant.out","w",stdout);

	scanf ("%d%d%d",&n,&m,&k);
	An[40000]=1;
	if (k<41000)
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++){
			memcpy(Bn,An,sizeof(An));
			for (int t=82000;t>=0;t--)
			{
			     An[t]=Bn[t-i*j]+Bn[t]+Bn[t+i*j];
				An[t]%=10000;
			}
		}
     else
          k=1;

	printf ("%d\n",An[40000+k]);
	return 0;

}