#include <iostream>
#include <iomanip>
using namespace std;
int maxlow(double a[]){
if(a[0]>=a[1]&&a[0]>=a[2]){
return 0;
}else if(a[1]>=a[0]&&a[1]>=a[2]){
return 1;
}else{
return 2;
}
}
int main()
{
double g1[3],g2[3],g3[3];
cin>>g1[0]>>g1[1]>>g1[2];
cin>>g2[0]>>g2[1]>>g2[2];
cin>>g3[0]>>g3[1]>>g3[2];
int r[3];
r[0]=maxlow(g1);
r[1]=maxlow(g2);
r[2]=maxlow(g3);
double res=g1[r[0]]*g2[r[1]]*g3[r[2]];
for(int i=0;i<3;i++){
switch(r[i]){
case 0:cout<<'W'<<" ";break;
case 1:cout<<'T'<<" ";break;
case 2:cout<<'L'<<" ";break;
}
}
cout<<fixed<<setprecision(2)<<(res*0.65-1)*2<<endl;
return 0;
}
英文有点难理解,这题的目的也有点难理解;
本质上还是很简单的
这是一个使用C++编写的程序,主要功能是从三个数组中找出每个数组的最大元素,并计算这些最大元素的特定乘积,同时输出相应的标识符。程序通过比较数组中的三个元素来确定最大值的位置。
351

被折叠的 条评论
为什么被折叠?



