Pagini recente » Cod sursa (job #550347) | Cod sursa (job #3246210) | Cod sursa (job #505374) | Cod sursa (job #1081226) | Cod sursa (job #2483461)
#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>=x && it.first-total<=x)next[it.first+i*j]=(next[it.first+i*j]+it.second)%MOD;
if(it.first-total<=x && it.first+total>=x)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;
}