ZJU PAT 1011. World Cup Betting

#include<iostream>
#include<cstdio>
using namespace std;

double sum=1.0;

string select(double a[])
{
	if(a[0]>a[1] && a[0]>a[2])
	{
		sum=sum*a[0];
		return "W";
	}
	else if(a[1]>a[2] && a[1]>a[3])
	{
		sum=sum*a[1];
		return "T";
	}
	else
	{
		sum=sum*a[2];
		return "L";
	}
}

int main()
{
	double a[3],b[3],c[3];
	while(scanf("%lf%lf%lf",&a[0],&a[1],&a[2])!=EOF)
	{
		scanf("%lf%lf%lf",&b[0],&b[1],&b[2]);

		scanf("%lf%lf%lf",&c[0],&c[1],&c[2]);

		printf("%s %s %s",select(a).c_str(),select(b).c_str(),select(c).c_str());

		sum=(sum*0.65-1)*2.0;

		printf(" %.2lf\n",sum);
	}
	return 0;
}

你可能感兴趣的:(ACM,pat,ZJU)