#include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<map> #include<vector> #include<queue> using namespace std; 找出每行的max(分别为a,b,c),最大期望收益为(a*b*c*0.65-1)*2 要用idx变量记录每行最大数字的下标,S[]={'W','T','L'}表示比赛结果使输出更方便 char S[3]={'W','T','L'}; //s[0]='W' s[1]='T' s[2]='L' int main(){ double ans=1.0,tmp,a; int idx; //记录每行最大数字的下标 for(int i=0;i<3;i++){ tmp=0.0; for(int j=0;j<3;j++){//寻找该行最大的数组存在于tmp scanf("%lf",&a); if(a>tmp){ tmp=a; idx=j; } } ans *= tmp; //按公式累乘 printf("%c ",S[idx]); //输出对应的比赛结果 } printf("%.2f",(ans*0.65 -1)*2); //输出最大收益 system("pause"); return 0; }