PAT甲级1011
来源:互联网 发布:激光祛痘的危害 知乎 编辑:程序博客网 时间:2024/06/05 17:14
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 L1.1 2.5 1.71.2 3.0 1.64.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 Input1.1 2.5 1.71.2 3.0 1.64.1 1.2 1.1Sample Output
T T W 37.98
#include<stdio.h>#include<algorithm>using namespace std;int main(){double A[3]; double a, b, c, Max;for (int i = 0; i < 3; i++){scanf("%lf %lf %lf", &a, &b, &c);Max = max(max(a,b),c);if (Max == a)printf("W ");else if(Max==b)printf("T ");else if(Max==c)printf("L ");A[i] = Max;}printf("%.2f", (A[0] * A[1] * A[2] * 0.65 - 1) *2);return 0;}
不知道为什么我跑样例时输出的是37.97,但提交后还是能AC
- PAT(甲级)1011
- PAT甲级1011
- PAT-甲级-1011
- PAT甲级1011
- PAT甲级 1011
- 浙大PAT甲级-1011
- 【PAT】甲级1011
- PAT 甲级
- PAT甲级 A1025.PAT RANKING
- PAT 甲级 1025 PAT Ranking
- PAT(甲级)1003
- PAT(甲级)1004
- PAT(甲级)1005
- PAT(甲级)1006
- PAT(甲级)1007
- PAT(甲级)1008
- PAT(甲级)1009
- PAT(甲级)1010
- Java集合库整体类结构
- 程序员面试金典: 9.9 递归和动态规划 9.6打印n对括号的全部有效组合
- xshell项目启动基本配置
- 使用事件总线eventbus替代startactivityforresult
- 第一个只出现一次的字符
- PAT甲级1011
- Java Socket编程1--讲解
- gulp入门教程
- 统计学相关基础
- js中函数没有重载,只有覆盖
- Struts1 Action
- Celery 学习笔记(3)- 任务和任务执行
- 在System.Timers.Timer的处理程序中调用MessageBox.Show()弹出的确是非模态的
- sysctl命令