PAT 甲级 1011 World Cup Betting
PAT 甲级 1011 World Cup Betting
For example, 3 games’ odds are given as the following:
W T L
1.1 2.5 1.7
1.2 3.1 1.6
4.1 1.2 1.1
Input Specification:
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 Specification:
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.1 1.6
4.1 1.2 1.1
结尾无空行
Sample Output:
T T W 39.31
结尾无空行
题意描述:
找出每行中赔率最大的,输出它所对应的的字母,然后用题目所给的公式计算收益就可以了。
解题思路:
每一行的赔率是独立的,因此可以单独对每一行计算最值,把相应的字母以及赔率都存储起来,最后再根据公式计算即可。
难度评测:Easy
AC代码实现:
#include <bits/stdc++.h>
using namespace std;
typedef pair<double, char> P;int main() {char ch[] = {'W', 'T', 'L'};double a[3];vector<P>v;for(int i = 0; i < 3; i++) {double mx = 0;int ind;for(int j = 0; j < 3; j++) {cin >> a[j];if(a[j] > mx) {mx = a[j];ind = j;}}v.push_back(P(mx, ch[ind]));}double ans = 1;for(auto tmp : v) {printf("%c ", tmp.second);ans *= tmp.first;}ans = (ans * 0.65 - 1) * 2;printf("%.2f", ans);
}
PAT 甲级 1011 World Cup Betting相关推荐
- PAT甲级1011 World Cup Betting:[C++题解]模拟
文章目录 题目分析 题目来源 题目分析 来源:acwing 分析:每场取最大的数. ac代码 #include<bits/stdc++.h> using namespace std;int ...
- 【PAT甲级】 1011 World Cup Betting
[PAT甲级] 1011 World Cup Betting 原题 With the 2010 FIFA World Cup running, football fans the world over ...
- PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642
PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...
- 浙江大学PAT上机题解析之1011. World Cup Betting (20)
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...
- 1011. World Cup Betting (20)
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...
- 1011 World Cup Betting (20 分)_14行代码AC
立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 With the 2010 FIFA World Cup running, football fans the world ove ...
- PAT甲级真题 1011 World Cup Betting (20分) C++实现
题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...
- 【PAT甲级 ArrayList存放class】1011 World Cup Betting (20 分) Java版 3/3通过 四舍五入保留两位小数
题目 一共给9个数,3*3,找到每行最大,按照题目要求套算式,计算就行 坑 & 心得 没啥坑,一次通过,用到的知识点是:自定义排序.四舍五入保留两位小数 DecimalFormat df = ...
- PAT甲题题解-1011. World Cup Betting (20)-误导人的水题。。。
题目不严谨啊啊啊啊 式子算出来结果是37.975 样例输出的是37.98 我以为是四舍五入的啊啊啊,所以最后输出的是sum+0.005 结果告诉我全部错误啊 结果直接保留两位小数就可以了啊啊啊啊 水题 ...
最新文章
- Jmeter(一)http接口添加header和cookie --转载
- python【蓝桥杯vip练习题库】BASIC-9特殊回文数
- [YTU]_1066 ( 输入n个数和输出调整后的n个数)
- 种群计数 (pop_count)
- mac java maven 设置
- 期货黄金与现货黄金比较
- 前端学习(586):在元素中动态添加类与伪类
- @Autowired注解能用在static属性吗?autowired注入static属性上为null
- mariadb mysql 创建_MariaDB 创建数据库,学习MariaDB,MariaDB教程,MariaDB手册,MariaDB学习,MariaDB实例 | 开发学院...
- c语言程序设计自学跟谁好,双辽c语言编程学习,双辽学c语言编程哪个好,双辽学c语言编程自学好还是报班好...
- 多么漂亮的重载构造方法呀!爱上.net
- RSocket 基于消息传递的反应式应用层网络协议
- 注册(二)之增加绑定
- 计算机生成目录步骤word,word生成目录步骤,word怎样做目录
- 相关性评估:皮尔逊相关系数,R2
- 微积分:2.1导数中的中值定理
- 1116: 删除元素(数组)
- Win10 IE浏览器无法打开HTTPS网站的解决方法--win10专业版
- cad角度怎么画_软件CAD | 直线amp;构造线
- CPU卡PSAM卡 响应指令
热门文章
- 华铭智能属于芯片概念吗_绩优滞涨的科技股名单来袭!两大活跃资金加仓股仅6只射频芯片龙头在列...
- 计算机发展史的pdf文档,计算机的发展历程.pdf
- HTML——Http协议
- echarts看板效果图:流光折线图、3d柱状图、3d饼图、3d地图
- 【IoT】NFC CPU 卡 AID 应用标识符规范
- 电子版标书怎么做?有哪些特点?
- Python django 在线练习考试系统
- outlook 日历 桌面_将Microsoft Outlook固定到桌面背景
- BI数据仪表盘可能带来的三大陷阱
- 山东大学项目实训十三——FFmpeg