Pagini recente » Cod sursa (job #2457212) | Cod sursa (job #2186741) | Cod sursa (job #2364126) | Cod sursa (job #1936466) | Cod sursa (job #1428815)
#include<fstream>
#include<cstring>
#define DIM 401 * 401
using namespace std;
int n, m, i, j, a, x, k, s, b;
int v[DIM * 2], aux[DIM * 2];
ifstream fin("diamant.in");
ofstream fout("diamant.out");
int main(){
fin>> n >> m >> x;
v[DIM] = aux[DIM] = 1;
for(i = 1; i <= n; i++){
for(j = 1; j <= m; j++){
s += i * j;
}
}
b = DIM;
for(i = 1; i <= n; i++){
for(j = 1; j <= m; j++){
a = i * j;
for(k = DIM -s; k <= DIM + s; k++){
if (k + a < 2 * DIM){
aux[k] = (v[k + a] + aux[k]) % 10000;
}
if (k - a >= 0){
aux[k] = (v[k - a] + aux[k]) % 10000;
}
}
memcpy(v, aux, sizeof(aux));
}
}
if(x >= -s && x <= s){
fout<< v[x + DIM] <<"\n";
}
else{
fout<<"0\n";
}
return 0;
}