Pagini recente » Cod sursa (job #470580) | Cod sursa (job #1122636) | Cod sursa (job #1813164) | Cod sursa (job #2750551) | Cod sursa (job #429464)
Cod sursa(job #429464)
#include<stdio.h>
#include<vector>
using namespace std;
#define Mmax 800000
#define mod 10000
int N,M,K;
int cnt[2][Mmax];
int Max,Tot;
void solve()
{
Tot = (N*(N+1)*M*(M+1))>>2;
Max = 2*Tot+1;
if (K > Tot)
{
printf("0\n");
return ;
}
cnt[0][Tot+1]=1;
int q=1,S;
for(int i=1;i<=N;++i)
for(int j=1;j<=M;++j)
{
for(int k=Max ; k>=0 ; --k)
{
S= i*j;
cnt[q][k]= ((k+S<=Max?cnt[q^1][k+S]:0) + (k-S>=0?cnt[q^1][k-S]:0) + cnt[q^1][k])%mod;
}
q^=1;
}
printf("%d\n",cnt[q^1][ Tot+K+1 ]);
}
int main()
{
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
scanf("%d%d%d",&N,&M,&K);
solve();
return 0;
}