Pagini recente » Cod sursa (job #57415) | Cod sursa (job #1783014) | Cod sursa (job #318740) | Cod sursa (job #1402841) | Cod sursa (job #1232083)
#include <cstdio>
#define mod 10000
using namespace std;
int n,m,x,t[401];
int v[2][100000];
int main()
{
int val,nr=0;
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
scanf("%d %d %d",&n,&m,&x);
if(x<0)
x=-x;
for(int i=1;i<=n;++i)
{
for(int j=1;j<=m;++j)
{
t[++nr]=i*j;
val+=t[nr];
}
}
if(x>val)
{
printf("0\n");
return 0;
}
v[0][0]=1;
for(int i=1;i<=nr;++i)
{
for(int k=0;k<=val;++k)
{
if(k-t[i]<0)
{
v[1][k]+=v[0][-k+t[i]];
}
else
{
v[1][k]+=v[0][k-t[i]];
}
v[1][k]+=v[0][k+t[i]];
}
for(int k=0;k<=val;++k)
{
v[0][k]+=v[1][k];
v[0][k]%=mod;
v[1][k]=0;
}
}
printf("%d\n",v[0][x]);
return 0;
}