标签:
Tom and paper
Description
Input
Output
Sample Input
Sample Output
1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<cmath> 5 using namespace std; 6 7 int main() 8 { 9 int T; 10 scanf("%d",&T); 11 while(T--) 12 { 13 int n; 14 scanf("%d",&n); 15 int a,c; 16 for(int i=1;i<=sqrt(n);i++) 17 { 18 a=2*(n+1); 19 20 if(n%i==0) 21 c=2*(n/i+i); 22 if(c<=a) 23 a=c; 24 } 25 printf("%d\n",a); 26 } 27 return 0; 28 }
标签:
原文地址:http://www.cnblogs.com/ttmj865/p/4693233.html