#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;
#define INF 1000000
int main()
{
int C;
cin >> C;
while (C--) {
int N;
cin >> N;
if (N == 0)
cout << 0 << endl;
int res = INF;
for (int a = 1; a <=N; a++) {
if (N%a != 0)
continue;
for (int b = 1; b <= N; b++) {
if ((N / a) % b != 0)
continue;
int c = N / a / b;
int temp = a*b + b*c + c*a;
if (res > temp)
res = temp;
}
}
cout << res * 2 << endl;
}
return 0;
}
[Coursera]算法基础_Week9_考试_Q4
最新推荐文章于 2017-10-18 00:38:25 发布