Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- n, min, k, c: integer;
- begin
- readln(n);
- k := trunc(sqrt(n));
- if (n mod k = 0) then c:=n div k
- else
- c:=(n div k)+1;
- min := c * k * 2 + (n mod c) *2 + c + k;
- if (n mod c <> 0) then
- dec(min,2*c);
- writeln(min);
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement