标签:
Description
Input
Output
Sample Input
3 2 7 12
Sample Output
6 16 14
#include<cstdio> #include<cmath> #include<algorithm> using namespace std; int main() { int T; int n; double x; int y; scanf("%d",&T); while(T--) { int ans=2*1000000000; scanf("%d",&n); x=sqrt(n); for(int i=1;i<=x;i++) { if(n%i==0) { y=n/i; ans=min(ans,2*(i+y)); } } printf("%d\n",ans); } return 0 ; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/a1967919189/article/details/47173955