PAT 1011

题目 : World Cup Betting

分值 : 20
难度 : 送分题
思路 : 弱智题
坑点 : 找出三个数最大的那个数, 利用 ?:实现
评语 : 挺简单的常规题

具体代码如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std ;
int main() {
float w , t , l ;
float sum = 1 ;
for(int i =0 ; i<3 ;i++)
{
cin >> w >>t >> l ;
float max = (w > t ? w : t ) > l ?(w > t ? w : t ) : l ;
if(max == w )
cout<< "W"<<" ";
else if(max == t)
cout<< "T"<<" ";
else
cout<< "L"<<" ";
sum*=max ;
}

printf("%.2lf" , 2*(sum*0.65-1) );

}