这个计算量不大,直接暴力解了。
#include <iostream>
#include <vector>
using namespace std;
void PrintResult(int i) {
switch (i)
{
case 0:cout << "W "; break;
case 1:cout << "T "; break;
case 2:cout << "L "; break;
default:
break;
}
}
int main() {
float first[3];
float second[3];
float third[3];
float ThisSum = 0;
float MaxSum = 0;
cin >> first[0] >> first[1] >> first[2];
cin >> second[0] >> second[1] >> second[2];
cin >> third[0] >> third[1] >> third[2];
int maxi = 0, maxj = 0, maxk = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
ThisSum = (first[i] * second[j] * third[k] * 0.65 - 1) * 2;
if (ThisSum > MaxSum) {
MaxSum = ThisSum;
maxi = i;
maxj = j;
maxk = k;
}
}
}
}
PrintResult(maxi);
PrintResult(maxj);
PrintResult(maxk);
printf("%.2F", MaxSum);
return 0;
}