Pagini recente » Cod sursa (job #1615108) | Cod sursa (job #2722847) | Cod sursa (job #3277118) | Cod sursa (job #552910) | Cod sursa (job #2483411)
#include <bits/stdc++.h>
#define MOD 10000
typedef long long ll;
std::map<ll, ll> map, next;
ll n, m, x, i, j;
int main()
{
freopen("diamant.in", "r", stdin);
freopen("diamant.out", "w", stdout);
scanf("%lld%lld%lld", &n, &m, &x);
map[0]=1;
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;
next[it.first+i*j]=(next[it.first+i*j]+it.second)%MOD;
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());
}
}
printf("%lld", map[x]);
fclose(stdin);
fclose(stdout);
return 0;
}