Pagini recente » Cod sursa (job #283777) | Cod sursa (job #1313225) | Cod sursa (job #1286551) | Cod sursa (job #3238398) | Cod sursa (job #117393)
Cod sursa(job #117393)
var f1,f2:text;
s,nr1,nr2,nr3,h1,h2,h3,i,j,g,ic:longint;
nr:int64;
begin
assign(f1,'plus.in');
reset(f1);
assign(f2,'plus.out');
rewrite(f2);
read(f1,s);
read(f1,nr1,h1);
read(f1,nr2,h2);
read(f1,nr3,h3);
for i:=0 to nr1 do
for j:=0 to nr2 do
begin
g:=(s-i*h1-j*h2);
if h3=0 then
ic:=nr3+1
else ic:=1;
if (g<=nr3)and(g>=0)and(g*h3+j*h2+i*h1=s) then
nr:=nr+ic;
end;
writeln(f2,nr);
close(f1);
close(f2);
end.