PAT1011 World Cup Betting

Sample Input

1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1
Sample Output
T T W 37.98

 

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
	int N = 3;
	float total = 1;
	string str;
	while (N--)
	{
		float x,y,z;
		cin>>x>>y>>z;
		float Max = max(max(x,y),z);
		if (Max == x)
		{
			str += "W ";
		}
		else if (Max == y)
		{
			str += "T ";
		}
		else
		{
			str += "L ";
		}
		total *= Max;
	}
	cout.setf(ios::fixed);
	float Result = (total * 0.65 - 1)*2;
	cout<<str<<setprecision(2)<<Result;
	return 0;
}
 

你可能感兴趣的:(pat)