Advertisement
Guest User

A1

a guest
Oct 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.69 KB | None | 0 0
  1.   var c,x,y,z,m,s,f,e: integer;
  2.       a,b,t: real;
  3. begin
  4.   // put your code here
  5.   Readln(c,x,y,z,m,s,f,e,t);
  6.    if (s div f)>e then
  7.     a:=m+t
  8.    else begin
  9.     y:=0;
  10.     repeat
  11.      z:=z+(s div f);
  12.      y:=y+1;
  13.     until z>e;
  14.     a:=y*m+t;
  15.    end;
  16.    if x>c then
  17.     b:=(c div s)*m
  18.    else begin
  19.     e:=0;f:=0;t:=0;
  20.     repeat
  21.      x:=x+z;
  22.      e:=e+1;
  23.     until x>=c;
  24.     if s>=(e*y) then
  25.      begin
  26.       f:=s-e*y;
  27.       t:=1;
  28.      end
  29.     else begin
  30.      f:=s mod y;
  31.      t:=(e*y)/s;
  32.      if t>int(t) then t:=t+1;
  33.     end;
  34.     b:=(c-f)/s;
  35.     if b>int(b) then b:=b+1;
  36.     b:=(b+t)*m
  37.    end;
  38.    if a>b then
  39.     Writeln(int(b))
  40.    else
  41.     Writeln(int(a));
  42. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement