[PAT甲级]1011. World Cup Betting (20)(世界杯投注)

PAT练习题(甲级) 1011 World Cup Betting (20分)(Java实现) PAT练习题 1011 World Cup Betting (20分)题干题意解题思路注意事项代码实现 题干 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Sim 阅读详情

1011. World Cup Betting (20)

原题链接

With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fans were putting their money where their mouths were, by laying all manner of World Cup bets.

Chinese Football Lottery provided a “Triple Winning” game. The rule of winning was simple: first select any three of the games. Then for each selected game, bet on one of the three possible results – namely W for win, T for tie, and L for lose. There was an odd assigned to each result. The winner’s odd would be the product of the three odds times 65%.

For example, 3 games’ odds are given as the following:

W T L
1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1
To obtain the maximum profit, one must buy W for the 3rd game, T for the 2nd game, and T for the 1st game. If each bet takes 2 yuans, then the maximum profit would be (4.1*3.0*2.5*65%-1)*2 = 37.98 yuans (accurate up to 2 decimal places).

Input

Each input file contains one test case. Each case contains the betting information of 3 games. Each game occupies a line with three distinct odds corresponding to W, T and L.

Output

For each test case, print in one line the best bet of each game, and the maximum profit accurate up to 2 decimal places. The characters and the number must be separated by one space.

Sample Input

1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1

Sample Output

T T W 37.98

题目大意:

  • 给出三行数字,代表三场比赛,每行有3个数字,分别是W T L三个投注,代表概率
  • 输出每场比赛的最大概率的投注和获得的最大利润,保留两位小数
  • 设每场比赛最大概率是max1 max2 max3, 最大利润 = (max1*max2*max3*65%-1)*2

代码:

#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

int main()
{
    char c[] = {'W', 'T', 'L'};
    vector<double> first(3);
    vector<double> secend(3);
    vector<double> third(3);
    vector<int> res;//存储最大值的下标
    int Max = 0;
    for(int i=0; i<3; i++){
        cin >> first[i];
        if(first[Max] <= first[i])
            Max = i;
    }
    res.push_back(Max);
    Max = 0;
    for(int i=0; i<3; i++){
        cin >> secend[i];
        if(secend[Max] <= secend[i])
            Max = i;
    }
    res.push_back(Max);
    Max = 0;
    for(int i=0; i<3; i++){
        cin >> third[i];
        if(third[Max] <= third[i])
            Max = i;
    }
    res.push_back(Max);
    cout << c[res[0]] << " " << c[res[1]] << " " << c[res[2]] << " ";
    printf("%.2f", (first[res[0]]*secend[res[1]]*third[res[2]]*0.65-1)*2);
    return 0;
}
最完整、最详细Oracle架构图 最完整、最详细Oracle架构图。很多教材、资料上的Oracle架构图没有这个详细的。看完以后绝对不后悔。 立即下载

相关推荐

新能源知识库(62)组串式、集中式和高压直挂式

因需多台PCS及独立监控设备,单位功率成本比集中式高15%–20%。高压直挂式因省去变压器,大容量项目成本更低(>5MW时优势显著)。组串式储能、集中式储能和高压直挂式储能是当前主流的三类技术路线,其核心差异源于系统架构和控制逻辑的设计差异。组串式交流侧需变压器升压至10kV/35kV,高压直挂式可直接输出6kV/35kV电压,减少转换损耗。多台小功率PCS并联(每簇独立管理)单台大功率PCS(多簇直流侧并联)环流导致容量衰减(损失5%–8%)无变压器损耗(效率>99%)高压直挂电站(≥10MW)

竹君子之家 1517

PAT:A1011 World Cup Betting (20 分)

PAT:A1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the ...

Ecloss 610

慕课软件质量保证与测试(习题集)

慕课金陵科技学院.软件质量保证与测试.期末复习.习题汇总0 总目录1 绪论1.1 软件质量保证与测试的产生与发展1.2 软件缺陷,软件错误,软件故障1.3 软件质量保证与测试的意义,原则和挑战1.4 单元测试1.5 课后作业2 软件测试策略2.1 软件测试的模型,过程和生命周期2.2 软件测试的方法和技术2.3 单元测试2.4 课后作业3 黑盒测试3.1 黑盒测试概述3.2 等价类划分测试3.3 边界值测试3.4 错误推测法3.5 判定表驱动法3.6 因果图法3.7 场景法3.8 正交实验法3.9 单元测试

weixin_42473228的博客 5万+

PAT乙级 1023 组个最小数

#include<iostream> #include<string> #include<map> #include<algorithm> #include<bits/stdc++.h> using namespace std; int main(void){ int n; vector<int> vec; for(int i=0; i<10; i++) { cin>&g.

邹九的个人博客 570

别再瞎改注册表了!实测Win10/Win11远程桌面60帧的正确姿势(附ToDesk对比)

本文深入解析Windows远程桌面60帧优化的科学方法,揭示常见误区并提供实测有效的解决方案。从版本差异到硬件加速,再到第三方工具对比(如ToDesk),帮助用户避开无效的注册表修改,实现流畅的远程桌面体验。

weixin_33738555的博客 344

用友U8其中一个账套提示演示期已到期-修复方法

【事件始末】 一朋友求助,反馈使用的用友U8,很多年了! 突然发现其中账套2021年的一个账套打不开,提示演示期限已到期! 但是其他账套完全正常,可以打开,没有任何问题。 不管是还原老旧备份,还是重装软件问题依旧,无法自己解决。 客户查询报表结算账期,情况比较紧急,于是求助我们。 经过多次反复琢磨和烟酒,终于于晚上23点59分给弄了出来,也总是圆满解决问题了。 【问题分析】 该用户打的是 U82X免狗补丁,估计是该补丁文件设置了 最大有效期,补丁到期了导致的。 也有可能是程序...

u010431289的博客 2万+

1011. World Cup Betting (20)

With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Sim

accbbbxx的博客 461

伺服电机入门01

编码器输出 旋转信号 , 接收端: 使用ADC 捕捉旋转信号 ,转成数字信号,驱动器得到数字处理, 因为信号量是模拟信号, mcu mpu 等芯片通常内部处理是数字,通过adc 得到数字cpu 才能识别 传输过来的pos 等信息。IPM 芯片示例, IRAM256A 这个芯片已经停产,有换新的,,下面示例来自stmbl 高功率方案,4 步进电机 有全步控制,半步控制 ,微步控制,FOC控制,步进电机也是可以做伺服系统的。以下面几种信号是可以细分,也就是通过细分增加编码器的分辨率,

qq_25160559的博客 970

Oracle架构之用户,权限,角色讲解

Oracle用户(user)就是访问oracle数据库的人。通过对用户的各种安全参数进行控制,以维护数据库的安全性,这些概念包括模式(schema)、权限、角色、存储设置、空间限额、存取资源限制、数据库审计等。当用户登录Oracle时需要进行身份认证,以便确认该用户能够进行的操作。认证是指对需要使用数据、资源或应用程序的用户进行身份确认。通过认证后,可以为用户后面的数据库操作提供一种可靠的连接关系。Oracle提供了多种身份认证方式:操作系统身份认证,Oracle 数据库身份认证,管理员身份认证。

上善若泪 3580

C#实践项目1

需求: 在CAD内实现两个坐标系的转换。 转换方式为文件内的所有图形从一个坐标系下的坐标,转换到另一个坐标系下的坐标。 进行坐标转换后,仅仅是坐标发生改变,图层、样式等等不会发生变化。

weixin_51182789的博客 5328

【问题解决】本地 Llama / Qwen 运行报错:transformers 版本不兼容、依赖冲突解决

Flask是一个轻量级的Web框架,设计上非常简单和易于扩展。它并不强制使用任何特定的项目结构或工具,这使得开发者能够根据自己的需求自由地设计应用。Flask的灵活性使它成为了许多小型项目和原型开发的理想选择。FastAPI是一个现代的Web框架,基于Python 3.7+,专为构建API而设计。FastAPI的特点是高性能、支持异步操作,并且内置了许多现代Web应用所需的功能,如数据验证和自动生成API文档等。从性能角度看,FastAPI在高并发场景下具有明显优势,特别是在I/O密集型的应用中。

博客 802

PAT甲级查找元素1011 World Cup Betting

昨天看了一本书,《你的灯亮着吗》,用一些小例子讲述各种情况下问题解决者面对问题做出的反应,很薄,不到两个小时就看完了, 会反复读。里面有一句话:当你以为你认为问题很好地解决了,其实并没有。正如下面这道题很简单,但显然有更简单的方法。 With the 2010 FIFA World Cup running, football fans the world over were becoming i...

qq_33819508的博客 266

手把手教你学Simulink——基于多能互补微电网系统的建模与优化场景实例:风柴储联合供电系统在孤岛模式下的功率分配建模

本文介绍了使用MATLAB/Simulink和Simscape Electrical构建风柴储联合供电系统的建模方法。系统包含风力发电、柴油发电、储能电池等模块,重点研究孤岛模式下功率分配策略。详细说明了从创建项目、添加模块到搭建风力发电系统(含MPPT控制)、柴油发电系统及集成各模块的全过程,并提供了仿真参数设置建议。通过分析频率偏差、电池SOC等关键指标,验证了系统在维持稳定运行的同时能有效利用可再生能源。该模型为研究多能互补微电网提供了实验平台,未来可拓展更高效的能量管理策略和AI技术的应用。

MHD0815的博客 1万+

PAT 甲级题目讲解:1011《World Cup Betting》

本文讲解 PAT 甲级 1011《World Cup Betting》解题思路,核心是每轮选择最大赔率并记录对应的下注选项(W/T/L),累乘后根据公式 `(ans * 0.65 - 1) * 2` 计算收益并保留两位小数输出,考察数组操作、最大值查找及格式化输出。

qq_35624947的博客 1151

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

PAT甲级 1011 World Cup Betting

PAT甲级 1011 World Cup Betting With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World C...

旺崽的博客 3011

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

【PAT甲级 - C++题解】1011 World Cup Betting

📣专栏定位:为想考甲级PAT的小伙伴整理常考算法题解,祝大家都能取得满分!

Newin2020的博客 895

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

[PAT-Advanced] A1011 World Cup Betting (20)

文章目录A1011 World Cup Betting (20point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis A1011 World Cup Betting (20point(s)) With the 2010 FIFA World Cup running, foot...

Duke 293

[PAT 甲级] 1011 World Cup Betting (20 分)

1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World...

cp0328的博客 3314

PAT 甲级 1011  World Cup Betting

1011 World Cup Betting (20 point(s)) With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for th...

漫浸天空的雨色的备忘录~ 901

PAT甲级(Advanced Level) Practice 1011 World Cup Betting

With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fans were putting their money

2301_78006009的博客 1329

pat甲级World_Cup_Betting 1011世界杯投注

原题 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fans were putting their mo

qq_53388188的博客 864

PAT甲级1011 World Cup Betting

PAT甲级1011 题目 1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles f...

领导的博客 275

PAT甲级 1011 World Cup Betting (20 分)

@[TOC](PAT甲级 1011 World Cup Betting (20 分)) 题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly,

weixin_44585441的博客 232

PAT 甲级 1011(World Cup Betting)

PAT 甲级 1011题目要求翻译代码思路 题目要求 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup...

qq_42865772的博客 247

【PAT 甲级】1011 World Cup Betting (20分)(模拟)

1011 World Cup Betting (20分) 题目 有三场比赛,每场比赛都有三种结果 W-win,T-tie,L-lose,每种结果有一定的赔率,分别输出每场比赛赔率最大的结果,并输出按照题中公式输出最大利润。 分析 甲级题目不难,都是些模拟题,就是英语看的太捉急了【看不懂。。】 #include <bits/stdc++.h> using namespace std; #...

Stormjing的博客 390

PAT甲级 1011 World Cup Betting (20分)

1011 World Cup Betting (20分) 题目链接:PAT A 1011 思路分析:嗯…这道题就很迷,我不知道它那个公式是怎么来的,开始还以为是按照题意,不同的数据对应不同的公式,后来才发现所有数据都是那个公式,但是我不太理解(原谅笨笨的我,大家有明白的别忘了告诉我啊~),但是不影响做题。就是找每行中赔率最大的输出它所对应的的字母,然后用那个公式计算收益就可以了。 AC代码: #...

weixin_43684054的博客 425
上一篇: [PAT甲级]1010. Radix (25)(求另一个数的基数)
下一篇: [PAT甲级]1012. The Best Rank (25)(最好排名)
whl_program
博客等级 码龄11年 101粉丝 279原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值