Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var c,x,y,z,m,s,f,e: integer;
- a,b,t: real;
- begin
- // put your code here
- Readln(c,x,y,z,m,s,f,e,t);
- if (s div f)>e then
- a:=m+t
- else begin
- y:=0;
- repeat
- z:=z+(s div f);
- y:=y+1;
- until z>e;
- a:=y*m+t;
- end;
- if x>c then
- b:=(c div s)*m
- else begin
- e:=0;f:=0;t:=0;
- repeat
- x:=x+z;
- e:=e+1;
- until x>=c;
- if s>=(e*y) then
- begin
- f:=s-e*y;
- t:=1;
- end
- else begin
- f:=s mod y;
- t:=(e*y)/s;
- if t>int(t) then t:=t+1;
- end;
- b:=(c-f)/s;
- if b>int(b) then b:=b+1;
- b:=(b+t)*m
- end;
- if a>b then
- Writeln(int(b))
- else
- Writeln(int(a));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement