AC代码

#include <cstdio>
#include <algorithm>
const int max_n = 3;
using namespace std;
/*
struct Bet {
double W, T, L
}bet[3]; void init() {
for(int i = 0; i < max_n; i++) {
bet[i].W = bet[i].T = bet[i].L = 0.0;
}
}
*/
int main() {
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE
char str[] = {'W', 'T', 'L'};
int str_record[3] = {0};
double max_record[3] = {0.0};
for(int i = 0; i < max_n; i++) {
double W = 0.0, T = 0.0, L = 0.0;
scanf("%lf%lf%lf", &W, &T, &L);
max_record[i] = (W>T)?(W>L?W:L):(T>L?T:L); //通过三元运算符比较大小
//printf("max_record[%d]:%lf\n", i, max_record[i]);
double temp = max_record[i];
//printf("temp:%lf\n", temp);
int j = temp==W?0:(temp==T?1:(temp==L?2:-1));//通过三元运算符确定哪个概率最大
//printf("num:%d\n", j);
str_record[i] = j;
max_record[i] = temp;
} for(int i = 0; i < max_n; i++) {
printf("%c ", str[str_record[i]]);
}
double result = 0.0;
result = (max_record[0] * max_record[1] * max_record[2] * 0.65 - 1) * 2;//
printf("%.2f", result);
return 0;
}

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. 【线性代数】4-1:四个正交子空间(Orthogonality of the Four Subspace)

    title: [线性代数]4-1:四个正交子空间(Orthogonality of the Four Subspace) categories: Mathematic Linear Algebra k ...

  2. synchronized的对象锁和类锁

    概念 synchronized 是 Java 中的关键字,是利用锁的机制来实现同步的. 锁机制有如下两种特性: 互斥性:即在同一时间只允许一个线程持有某个对象锁,通过这种特性来实现多线程中的协调机制, ...

  3. array_column()用法

    <?php $arr = [ [ 'id' => 1, 'name' => 'a' ],[ 'id' => 2, 'name' => 'b', ], [ 'id' =&g ...

  4. C#操作 Access 2013(.accdb)的方法

    使用的Microsoft.Jet.OLEDB.4.0,的方法并不能连接最新的Access 存储文件,而且Microsoft.Jet.OLEDB.4.0不能使用x64的方式生成,而且使用这个数据库引擎效 ...

  5. UITableView动态改变Cell高度

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

  6. crobtab

    在使用node-cron包,作者在issue建议使用 https://crontab.guru/ 测试使用定时任务 发现一个问题 https://crontab.guru/#0_23_11-12,18 ...

  7. nginx 的使用

    nginx 反向代理,并拥有其高效的性能,并发效果好,是解决跨域最好的选择 nginx 的使用 1. 下载:在官网上下载 window 系统的 nginx 网址:http://nginx.org/en ...

  8. Android 美团Robust热更新 使用入门

    Android热更新方案Robust 相信很多人都认识了解过 热修复.热更新.热补丁(对于这个技术也没有特别标准的一种叫法,下面我统一叫热更新),之后的一年里,各种热更新方案如雨后春笋般出现,比较耳熟 ...

  9. LC 971. Flip Binary Tree To Match Preorder Traversal

    Given a binary tree with N nodes, each node has a different value from {1, ..., N}. A node in this b ...

  10. 注解方式实现AOP编程

    步骤: 1) 先引入aop相关jar文件           (aspectj  aop优秀组件) spring-aop-3.2.5.RELEASE.jar   [spring3.2源码] aopal ...