目录
题目
题目链接:1011 World Cup Betting (PAT (Advanced Level) Practice)
输入样例
1.1 2.5 1.7
1.2 3.1 1.6
4.1 1.2 1.1
输出样例
T T W 39.31
提交结果截图
源代码
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int max[3];
float max_profit = 1;
float odd[3][3];
for(int i = 0; i < 3; i++)
{
max[i] = 0;
for(int j = 0; j < 3; j++)
{
cin>>odd[i][j];
if(odd[i][j] > odd[i][max[i]])
max[i] = j;
}
}
for(int i = 0; i < 3; i++)
{
switch (max[i])
{
case 0: cout<<"W ";
break;
case 1: cout<<"T ";
break;
case 2: cout<<"L ";
break;
}
max_profit *= odd[i][max[i]];
}
max_profit = (max_profit*0.65 - 1)*2;
printf("%.2f", max_profit);
return 0;
}