CF859B.Lazy Security Guard

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 NN city blocks, but they let him choose which blocks. That is, your friend must walk the perimeter of a region whose area is exactly NN 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 NN ( 1<=N<=1061<=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
    

说明/提示

Here are some possible shapes for the examples:

首页