Pagini recente » Cod sursa (job #2981334) | Cod sursa (job #140572) | Cod sursa (job #978882) | Cod sursa (job #1158900) | Cod sursa (job #35801)
Cod sursa(job #35801)
var f:text;
n,m,i,j:integer;
h,h2:byte;
x,k:longint;
a:array[1..2,-50000..50000] of qword;
begin
assign(f,'diamant.in');
reset(f);
read(f,n,m,x);
close(f);
if (x>n*(n+1)*m*(m+1) div 4) or
(x<-n*(n+1)*m*(m+1) div 4) then begin
assign(f,'diamant.out');
rewrite(f);
writeln(f,0);
close(f);
end
else begin
a[1,0]:=1;
h:=1;
h2:=2;
for i:=1 to n do
for j:=1 to m do
begin
for k:=-44100 to 44100 do
a[h2,k]:=a[h,k-i*j]+a[h,k+i*j]+a[h,k];
h2:=h;
h:=h mod 2+1;
end;
assign(f,'diamant.out');
rewrite(f);
writeln(f,a[h,x]);
close(f);
end;
end.