这题相对比较好做。
主要就是比大小,唯一值得注意的就是最后面那个四舍五入。。
代码如下:
#include"stdio.h"
#include"string.h"
#include"math.h"
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
#define INF 0x7FFFFFFF
int main(){
float in[3][3];
float max[3] = {-1.0,-1.0,-1.0};
char best[3];
for(int i = 0;i < 3;i++){
for(int j = 0;j < 3;j++){
scanf("%f",&in[i][j]);
int temp = -1;
if(in[i][j] - max[i]>1e-6){
max[i] = in[i][j];
temp = j;
}
switch(temp){
case 0:
best[i] = 'W';
break;
case 1:
best[i] = 'T';
break;
case 2:
best[i] = 'L';
}
}
}
float profit = (max[0]*max[1]*max[2]*0.65 - 1)*2;
printf("%c %c %c %.2f",best[0],best[1],best[2],profit+0.005);
return 0;
}