PAT (Advanced Level) 1011 World Cup Betting (20 分)
发布日期:2021-06-29 12:22:26 浏览次数:2 分类:技术文章

本文共 530 字,大约阅读时间需要 1 分钟。

序:

水题,找三个数最大值并记录乘积与下标

题目概述:

给出三个比赛的赔率,求最大的获利方案

分析:

求最大值&记录

#include
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元的本金,以及三场比赛。

转载地址:https://bridge-killer.blog.csdn.net/article/details/115433195 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:PAT (Advanced Level) 1012 The Best Rank (25 分)
下一篇:PAT (Advanced Level) 1007 Maximum Subsequence Sum (25 分)

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月16日 21时05分49秒