AC代码

  1. #include <cstdio>
  2. #include <algorithm>
  3. const int max_n = 3;
  4. using namespace std;
  5. /*
  6. struct Bet {
  7. double W, T, L
  8. }bet[3];
  9. void init() {
  10. for(int i = 0; i < max_n; i++) {
  11. bet[i].W = bet[i].T = bet[i].L = 0.0;
  12. }
  13. }
  14. */
  15. int main() {
  16. #ifdef ONLINE_JUDGE
  17. #else
  18. freopen("1.txt", "r", stdin);
  19. #endif // ONLINE_JUDGE
  20. char str[] = {'W', 'T', 'L'};
  21. int str_record[3] = {0};
  22. double max_record[3] = {0.0};
  23. for(int i = 0; i < max_n; i++) {
  24. double W = 0.0, T = 0.0, L = 0.0;
  25. scanf("%lf%lf%lf", &W, &T, &L);
  26. max_record[i] = (W>T)?(W>L?W:L):(T>L?T:L); //通过三元运算符比较大小
  27. //printf("max_record[%d]:%lf\n", i, max_record[i]);
  28. double temp = max_record[i];
  29. //printf("temp:%lf\n", temp);
  30. int j = temp==W?0:(temp==T?1:(temp==L?2:-1));//通过三元运算符确定哪个概率最大
  31. //printf("num:%d\n", j);
  32. str_record[i] = j;
  33. max_record[i] = temp;
  34. }
  35. for(int i = 0; i < max_n; i++) {
  36. printf("%c ", str[str_record[i]]);
  37. }
  38. double result = 0.0;
  39. result = (max_record[0] * max_record[1] * max_record[2] * 0.65 - 1) * 2;//
  40. printf("%.2f", result);
  41. return 0;
  42. }

PAT A1011 World Cup Betting(20)的更多相关文章

  1. PAT 1011 World Cup Betting (20分) 比较大小难度级别

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

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

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

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

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

  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 甲级 1011 World Cup Betting (20)(20 分)(水题,不用特别在乎精度)

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

  7. pat1011. World Cup Betting (20)

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

  8. PATA 1011 World Cup Betting (20)

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

  9. pat 1011 World Cup Betting(20 分)

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

随机推荐

  1. C# 父类代码动态转换子类

    百度上搜索C# 如何父类运行时转换成子类,没有得到相应答案,突然想起C# 有dynamic类型试试看结果成功了... 以后编写代码类似这样的代码 就可以删减掉了 if (en.type == EMap ...

  2. 基于熵的方法计算query与docs相似度

    一.简单总结 其实相似度计算方法也是老生常谈,比如常用的有: 1.常规方法 a.编辑距离 b.Jaccard c.余弦距离 d.曼哈顿距离 e.欧氏距离 f.皮尔逊相关系数 2.语义方法 a.LSA ...

  3. Java线程的启动和停止(一)

    如何构造线程 在运行线程之前需要先构造线程对象,线程对象的构造需要指定线程所需要的属性,比如:所属线程组.线程优先级.是否为Daemon线程等信息.下面我们看一下,java.lang.Thread中对 ...

  4. Http通讯协议

    第一.http 通信协议的基本原理 一次 HTTP 请求的通信流程 流程图     DNS: (Domain Name System)服务是和 HTTP 协议一样位于应用层的协议.它提供域名到 IP ...

  5. Spring Boot中的事务管理 隔离级别

    在声明事务时,只需要通过value属性指定配置的事务管理器名即可,例如:@Transactional(value="transactionManagerPrimary"). 除了指 ...

  6. UITableView动态改变Cell高度

    demo下载地址:https://github.com/smileyborg/TableViewCellWithAutoLayout 版权声明:本文为博主原创文章,未经博主允许不得转载.

  7. Nslookup: command not found error on RHEL/CentOS 7

    Reference: https://unix.stackexchange.com/questions/164210/nslookup-command-not-found-error-on-rhel- ...

  8. 黑马vue---18、v-for指令的四种使用方式

    黑马vue---18.v-for指令的四种使用方式 一.总结 一句话总结: (item, i) in list:什么in什么的形式,前面是各种参数 1.v-for循环普通数组? <p v-for ...

  9. Elasticsearch6.5.1破解x-pack,设置密码并使用head插件登陆。

    #没有许可证的es无法持久的设置密码,而且使用一段时间后会过期,过期后,一些功能无法被使用,例如head插件无法看到es状态. 下图是过期的es的状态,可通过此url查看:http://ip:port ...

  10. 【学习笔记】QT常用类及应用

    一.QT基类: QObject 二.QT中常用的库 QT中的类根据功能划分在不同的库中,在用户属性.pro文件中可以看到. 三.Qt基本对话框的使用 常用5类: 通过类名可以直接调用类的静态成员函数. ...