PAT (Advanced Level) 1011 World Cup Betting (20 分)
程序员文章站
2022-07-15 13:25:49
...
序:
水题,找三个数最大值并记录乘积与下标
题目概述:
给出三个比赛的赔率,求最大的获利方案
分析:
求最大值&记录
#include<bits/stdc++.h>
using namespace std;
char dict[3] = {'W','T','L'};
int main()
{
double a, b, c, maxn;
double res = 1.0;
int maxindex;
while(cin >> a >> b >> c)
{
maxn = max(a, max(b, c));
if(maxn == a) cout << dict[0] << " ";
else if(maxn == b) cout << dict[1] << " ";
else cout << dict[2] << " ";
res *= maxn;
}
printf("%.2f\n",(res * 0.65 - 1.00) * 2.0);
return 0;
}
吐槽:
最好在题目输入说明那里也注明是2元的本金,以及三场比赛。
推荐阅读
-
PATA 1011 World Cup Betting (20)
-
PAT (Advanced Level) 1015 Reversible Primes (20 分)
-
PAT (Advanced Level) 1008 Elevator (20 分)
-
PAT (Advanced Level) 1011 World Cup Betting (20 分)
-
1011 World Cup Betting (20 分)_14行代码AC
-
PAT (Advanced Level) 1073 Scientific Notation(20 分)科学计数法
-
PAT甲级 1011 World Cup Betting 模拟
-
PATA 1011 World Cup Betting (20)