标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5224
题意:
给出矩形的面积,求出最小的周长。
样例:
Sample Input
Sample Output
1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int i; 5 int main() 6 { 7 int t,n; 8 cin>>t; 9 while(t--) 10 { 11 cin>>n; 12 int m; 13 for(i=sqrt(n);i<=n;i++) 14 { 15 if(n%i==0) 16 { m=i+n/i; 17 break; 18 } 19 } 20 cout<<m*2<<endl; 21 } 22 return 0; 23 }
标签:
原文地址:http://www.cnblogs.com/fenhong/p/4694242.html