很简单的一题,不过我的解法看起来有点幼稚,用了太多if.
#include<iostream>
using namespace std;
int main()
{
int i,i1,i2,i3;
char c1,c2,c3;
float a[10],M1=0.0,M2=0.0,M3=0.0;
for(i=0;i<9;i++)
cin>>a[i];
for(i=0;i<3;i++)
{
if(a[i]>M1)
{
//cout<<a[i]<<"-*-"<<M1<<"-*-"<<(a[i]>M1);
M1=a[i];
i1=i;
}
if(a[i+3]>M2)
{
M2=a[i+3];
i2=i+3;
}
if(a[i+6]>M3)
{
M3=a[i+6];
i3=i+6;
}
}
//cout<<M1<<" "<<M2<<" "<<M3<<i1<<" "<<i2<<" "<<i3<<endl;
if(i1==0) c1='W';
if(i1==1) c1='T';
if(i1==2) c1='L';
if(i2==3) c2='W';
if(i2==4) c2='T';
if(i2==5) c2='L';
if(i3==6) c3='W';
if(i3==7) c3='T';
if(i3==8) c3='L';
cout<<c1<<" "<<c2<<" "<<c3<<" ";
printf("%.2f",((a[i1]*a[i2]*a[i3]*0.65-1)*2));
return 0;
}