pat 1011. World Cup Betting (20)

链接:http://pat.zju.edu.cn/contests/pat-a-practise/1011

 

题意:给定数据,找到每行的最大值根据公式计算结果。

 

分析:简单模拟题目。

 

#include<stdio.h>

double bigger(double a, double b) {
	if (a > b)
		return a;
	else
		return b;
}

int main() {
	double max1, max2, max3;
	char bet1, bet2, bet3;
	double w, t, l;
	scanf("%lf%lf%lf", &w, &t, &l);
	max1 = bigger(bigger(w, t), l);
	if (max1 == w)
		bet1 = 'W';
	else if (max1 == t)
		bet1 = 'T';
	else
		bet1 = 'L';

	scanf("%lf%lf%lf", &w, &t, &l);
	max2 = bigger(bigger(w, t), l);
	if (max2 == w)
		bet2 = 'W';
	else if (max2 == t)
		bet2 = 'T';
	else
		bet2 = 'L';

	scanf("%lf%lf%lf", &w, &t, &l);
	max3 = bigger(bigger(w, t), l);
	if (max3 == w)
		bet3 = 'W';
	else if (max3 == t)
		bet3 = 'T';
	else
		bet3 = 'L';

	printf("%c %c %c %.2lf\n", bet1, bet2, bet3,
			(max1 * max2 * max3 * 0.65 - 1) * 2);

	return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值