Cod sursa(job #483396)

Utilizator zloteanu.adrianzloteanu adrian nichita zloteanu.adrian Data 8 septembrie 2010 16:05:17
Problema Diamant Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
#include<string.h>
using namespace std;
int a[88205],b[88205];
int main()
{ifstream q("diamant.in");
ofstream w("diamant.out");
int n,m,k;
q>>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;
w<<b[40000+k]<<"\n";
return 0;
}