Pagini recente » Cod sursa (job #1873604) | Cod sursa (job #1411267) | Cod sursa (job #129099) | Cod sursa (job #2940944) | Cod sursa (job #940435)
Cod sursa(job #940435)
const ct=10000;
var f:text;
c1,cn:array[-44100..44100] of integer;
v:array[1..400] of integer;
smax,n,m,i,j,k,x,p:longint;
begin
assign(f,'diamant.in'); reset(f);
readln(f,n,m,x);
smax:=0;
p:=0;
for i:=1 to n do
for j:=1 to m do
begin
inc(p);
v[p]:=i*j;
smax:=smax+v[p];
end;
close(f);
assign(f,'diamant.out'); rewrite(f);
if (x<-smax) or (smax<x) then writeln(f,0)
else
begin
c1[-1]:=1;
c1[0]:=1;
c1[1]:=1;
for k:=2 to p do
begin
fillchar(cn,sizeof(cn),0);
for j:=-smax to smax do
if c1[j]>0 then
begin
cn[j]:=(longword(cn[j])+longword(c1[j]))mod ct;
cn[j-v[k]]:=(longword(cn[j-v[k]])+longword(c1[j]))mod ct;
cn[j+v[k]]:=(longword(cn[j+v[k]])+longword(c1[j]))mod ct;
end;
c1:=cn;
end;
writeln(f,c1[x]);
end;
close(f);
end.