Pagini recente » Cod sursa (job #947359) | Cod sursa (job #303439) | Cod sursa (job #1720517) | Cod sursa (job #2167935) | Cod sursa (job #2564315)
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
const int valmax=44100;
const int modulo=10000;
ifstream f ("diamant.in");
ofstream g ("diamant.out");
long long n,m,x,dp[2][2*valmax+10],i,j,k,acm=1,vch=0;
int main()
{
f >> n >> m >> x;
x+=valmax;
if(x>2*valmax) {
g << 0;
return 0;
}
dp[0][valmax]=1;
for(i=1; i<=n; i++)
for(j=1; j<=m; j++) {
for(k=0; k<=2*valmax; k++)
dp[acm][k]=(dp[vch][k-i*j]+dp[vch][k]+dp[vch][k+i*j])%modulo;
swap(acm,vch);
}
g << dp[vch][x];
return 0;
}