'commit'
This commit is contained in:
22
TangDou/LanQiaoBei/LanQiao14GuoSai/Test1.cpp
Normal file
22
TangDou/LanQiaoBei/LanQiao14GuoSai/Test1.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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 (a = 1; a <= n; a++)
|
||||
for (b = a; b <= n; b++)
|
||||
for (c = b; c <= n; c++) {
|
||||
if (n == a * b * c) {
|
||||
if (b - a + c - b + c - a < res) {
|
||||
res = b - a + c - b + c - a;
|
||||
a1 = a, b1 = b, c1 = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "a=" << a1 << ",b=" << b1 << ",c=" << c1 << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user