Pagini recente » Cod sursa (job #2643404) | Cod sursa (job #2605744) | Cod sursa (job #2574618) | Cod sursa (job #3210792) | Cod sursa (job #35094)
Cod sursa(job #35094)
var f:text;
c1,cn:array[-64410..64410] 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]:=cn[j]+c1[j];
cn[j-v[k]]:=cn[j-v[k]]+c1[j];
cn[j+v[k]]:=cn[j+v[k]]+c1[j];
end;
c1:=cn;
end;
writeln(f,cn[x]);
end;
close(f);
end.