Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. var
  2. n, min, k, c: integer;
  3. begin
  4. readln(n);
  5. k := trunc(sqrt(n));
  6. if (n mod k = 0) then c:=n div k
  7. else
  8. c:=(n div k)+1;
  9. min := c * k * 2 + (n mod c) *2 + c + k;
  10. if (n mod c <> 0) then
  11. dec(min,2*c);
  12. writeln(min);
  13. readln;
  14. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement