题库练习 Lazy Security Guard
← 上一题 下一题 →

A11235 | Lazy Security Guard

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Your security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly $N$ city blocks, but they let him choose which blocks. That is, your friend must walk the perimeter of a region whose area is exactly $N$ blocks. Your friend is quite lazy and would like your help to find the shortest possible route that meets the requirements. The city is laid out in a square grid pattern, and is large enough that for the sake of the problem it can be considered infinite.

输入格式

Input will consist of a single integer $N$ ( $1<=N<=10^{6}$ ), the number of city blocks that must be enclosed by the route.

输出格式

Print the minimum perimeter that can be achieved.

输入输出样例

输入 #1
4
输出 #1
8
输入 #2
11
输出 #2
14
输入 #3
22
输出 #3
20
C++ 编辑器
输入
输出