Pagini recente » Cod sursa (job #2957784) | Cod sursa (job #1512921) | Cod sursa (job #1679095) | Cod sursa (job #2168464) | Cod sursa (job #425933)
Cod sursa(job #425933)
#include <stdio.h>
#include <string.h>
const int base = 10000;
int a[100000],
b[100000];
int n, m, i, j, t, x;
int main()
{
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
scanf("%d %d %d", &n, &m, &x);
a[50000] = 1;
if (x > 45000 || x < -45000)
{
printf("0\n");
return 0;
}
for (i = 1; i<= n; ++ i)
for (j = 1; j <= m; ++ j)
{
int p = i*j;
memcpy(b,a,sizeof(a));
for (t = 1000; t <= 99000; ++ t)
{
a[t] = b[t] + b[t-p] + b[t+p];
while (a[t] >= base)
a[t] -=base;
}
}
printf("%d", a[50000+x]%base);
return 0;
}