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