POJ 2363
#include<iostream> #include<stdio.h> using namespace std; int main() { //freopen("acm.acm","r",stdin); int test; int num; int i; int j; int max; int tem; int h; int are; cin>>test; while(test --) { max = 100000000; cin>>num; for(h = 1; h <= num; ++ h) { if(num%h == 0) { are = num/h; for(i = 1; i*i < are + 1; ++ i) { if(are%i == 0) { j = are/i; tem = 2*i*j + 2*i*h + 2*j*h; if(tem < max) max = tem; } } } } cout<<max<<endl; } }