# Tom and paper

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 679    Accepted Submission(s): 432

Problem Description
There is a piece of paper in front of Tom, its length and width are integer. Tom knows the area of this paper, he wants to know the minimum perimeter of this paper.

Input
In the first line, there is an integer T indicates the number of test cases. In the next T lines, there is only one integer n in every line, indicates the area of paper.
T10,n109

Output
For each case, output a integer, indicates the answer.

Sample Input
3 2 7 12

Sample Output
6 16 14

Source

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
int t,n,root;
cin>>t;
while(t--)
{
cin>>n;
root=sqrt(1.0*n);
for(int i=root;;i--)
{
if(n%i==0)
{
cout<<2*(i+n/i)<<endl;
break;
}
}
}
return 0;
}


• 本文已收录于以下专栏：

## hdu5505 GT and numbers(BestCoder Round #60)

GT and numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To...
• d_x_d
• 2015年10月18日 14:31
• 1000

## hdu 4982 Goffi and Squary Partition（BestCoder Round #6）

Goffi and Squary Partition Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (J...
• 2014年08月25日 20:28
• 3460

## hdu5463 Clarke and minecraft（BestCoder Round #56 (div.2) ）

Clarke and minecraft Accepts: 414 Submissions: 738 Time Limit: 2000/1000 MS (Java/Others) Memory...
• d_x_d
• 2015年09月19日 20:31
• 1035

## HDU 5562 Clarke and food(排序)——BestCoder Round #62(div.2)

HDU 5562 Clarke and food(排序)——BestCoder Round #62(div.2)

## hdu 5057 Argestes and Sequence（BestCoder Round #11)

Argestes and Sequence                                                          Time Limit: 5000/250...
• 2014年10月06日 21:29
• 707

## 【HDU5563 BestCoder Round 62 (div1)A】【计算几何 凸包】Clarke and five-pointed star 正五边形判定 正五角星判定

#include #include #include #include #include #include #include #include #include #include #include ...

## hdu 5505 GT and numbers【BestCoder Round #60】

GT and numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

举报原因： 您举报文章：HDU 5224 Tom and paper(BestCoder Round #40) 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)