https://pintia.cn/problem-sets/994805342720868352/problems/994805504927186944

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.1 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 ( yuans (accurate up to 2 decimal places).

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 WT 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

代码:

#include <bits/stdc++.h>
using namespace std; struct Game{
double w;
double t;
double l;
double maxx;
char res;
}game[10010]; int main() {
for(int i = 1; i <= 3; i ++) {
scanf("%lf%lf%lf", &game[i].w, &game[i].t, &game[i].l);
game[i].maxx = max(max(game[i].w, game[i].t), game[i].l);
if(game[i].maxx == game[i].w) game[i].res = 'W';
else if(game[i].maxx == game[i].t) game[i].res = 'T';
else game[i].res = 'L';
} double money = 1;
for(int i = 1; i <= 3; i ++) {
money *= game[i].maxx;
}
money = (money * 0.65 - 1) * 2; for(int i = 1; i <= 3; i ++)
printf("%c ", game[i].res);
printf("%.2lf\n", money); return 0;
}

  

PAT 甲级 1011 World Cup Betting的更多相关文章

  1. PAT 甲级 1011 World Cup Betting (20)(20 分)

    1011 World Cup Betting (20)(20 分)提问 With the 2010 FIFA World Cup running, football fans the world ov ...

  2. PAT 甲级 1011 World Cup Betting (20)(代码+思路)

    1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...

  3. PAT 甲级 1011 World Cup Betting (20)(20 分)(水题,不用特别在乎精度)

    1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...

  4. PAT甲级——1011 World Cup Betting

    PATA1011 World Cup Betting With the 2010 FIFA World Cup running, football fans the world over were b ...

  5. PAT甲 1011. World Cup Betting (20) 2016-09-09 23:06 18人阅读 评论(0) 收藏

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

  6. PAT Advanced 1011 World Cup Betting (20 分)

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  7. PAT甲级——A1011 World Cup Betting

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  8. 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 ...

  9. PAT 1011 World Cup Betting

    1011 World Cup Betting (20 分)   With the 2010 FIFA World Cup running, football fans the world over w ...

随机推荐

  1. Linux笔记(开机自动将kerne log保存到SD卡中)

    有时候为了测试机器的稳定性,需要煲机测试几天的情况,这个时候机器已经封装好,不能再接串口线出来. 为了追溯问题,就需要将log信息保存下来. 于是就需要这样一个功能:系统启动后,自动将kernel的l ...

  2. 旧文备份:VC中嵌入NASM编写的汇编函数

    在公司开发的RT下没法使用C库,并且替代库函数没有几个,需要用到setjmp和longjmp函数,没办法,只能自己想办法了,上sourceforge淘换到一个小日本的工程,提供这两个函数的替代源码,名 ...

  3. matlab时间测试

    因为想把样本筛选一下,所以简单的分类器先跑了一下,没想到跑完分类器在对样本筛选时的时间大大超过了样本进分类器的时间,这个显然不能达到我要的节省时间目的.于是分析了一下matlab中各个环节的时间成本, ...

  4. css英文长文字会自动换行的解决办法

    iPhone5中显示的效果如下图: 代码修改: 修改后效果如图:

  5. django中的构造字典(二级菜单,评论树,购物车)

    1.构造父子结构: 1.1需求样式 客户列表 customer_list /customer/list/ -----> 添加客户 customer_add /customer/add/ ---- ...

  6. android 圆角图片的实现形式

    android 圆角图片的实现形式,包括用第三方.也有系统的.比如makeramen:roundedimageview,系统的cardview , glide .fresco . compile 'c ...

  7. 【课堂笔记精选】为了能够用“Unity”软件做游戏,我要从最基础的开始复习JavaScript

    [声明]在“随笔”模块,只是知识点,但是在“文章”模块(https://www.cnblogs.com/Robot-DX3906/articles/10579584.html)里面,有更多内容. 20 ...

  8. java后台poi根据模板导出excel

    public class ExcelUtils { private static final String INSPECTIONRECORD_SURFACE_TEMPLET_PATH = " ...

  9. vue学习笔记-:class

    当items.state为true时使用class='rad2state',否则为rad2(默认).

  10. FreeBSD--如何最有效率的安装软件

    Freebsd 下如何最有效率的安装软件 From <https://www.cnblogs.com/apexchu/p/4131821.html> FreeBSD的默认下载工具是fetc ...