Cod sursa(job #117393)
Utilizator | Data | 21 decembrie 2007 13:33:14 | |
---|---|---|---|
Problema | Plus | Scor | 40 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.73 kb |
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.