PAT 甲级测试题目 -- 1011 World Cup Betting

题目链接

题目描述

见题目链接。。。这题太水了。。。

分析

取 3*3 数组每行最大值,累乘之后按照题目描述的公式计算输出就好

实现

#include<iostream>
using namespace std;
int main() {
	double odds[3][3];
	int result[3];
	char Types[3] = { 'W','T','L' };
	double points = 1, maxo = 0;

	
	for (int i = 0; i < 3; i++)
	{
		maxo = 0;
		for (int j = 0; j < 3; j++)
		{
			cin >> odds[i][j];
			if (odds[i][j] > maxo) {
				maxo = odds[i][j];
				result[i] = j;
			}							
		}
		points *= maxo;				
	}

	

	for (int i = 0; i < 3; i++) {
		cout << Types[result[i]] << " ";
	}
	printf("%.2f", (points *0.65 - 1.0) * 2.0);
        return 0;
}
原文地址:https://www.cnblogs.com/Breathmint/p/10292005.html