Pagini recente » Cod sursa (job #1991106) | Cod sursa (job #2644318) | Cod sursa (job #2906106) | Cod sursa (job #1922821) | Cod sursa (job #2483455)
#include <bits/stdc++.h>
#define MOD 10000
typedef long long ll;
std::map<ll, ll> map, next;
ll n, m, x, i, j, total;
int main()
{
freopen("diamant.in", "r", stdin);
freopen("diamant.out", "w", stdout);
scanf("%lld%lld%lld", &n, &m, &x);
map[0]=1;
total=n*(n+1)*m*(m+1)/4;
for(i=1; i<=n; ++i){
for(j=1; j<=m; ++j){
for(auto &it:map){
next[it.first]=(next[it.first]+it.second)%MOD;
if(it.first<=total)next[it.first+i*j]=(next[it.first+i*j]+it.second)%MOD;
if(it.first>=-total)next[it.first-i*j]=(next[it.first-i*j]+it.second)%MOD;
}
map.erase(map.begin(), map.end());
map.insert(next.begin(), next.end());
next.erase(next.begin(), next.end());
}
total-=i*j;
}
printf("%lld", map[x]);
fclose(stdin);
fclose(stdout);
return 0;
}