You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
567 B
23 lines
567 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int n = 9;
|
|
const int INF = 0x3f3f3f3f;
|
|
int res = INF, a1, b1, c1;
|
|
int main() {
|
|
int a, b, c;
|
|
for (int a = 1; a * a * a <= n; a++) {
|
|
for (int b = a; a * b * b <= n; b++) {
|
|
int c = n / a / b;
|
|
if(a*b*c==n){
|
|
if(2*c-2*a<res){
|
|
res = 2 * c - 2 * a;
|
|
a1 = a, b1 = b, c1 = c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int ans = (a1 * b1 + a1 * c1 + b1 * c1) * 2;
|
|
cout << ans << endl;
|
|
return 0;
|
|
} |