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;
}

最新文章

  1. 每次新建项目出现appcompat_v7 解决方法
  2. [Erlang 0108] Elixir 入门
  3. jquery动态删除html代码
  4. acdream1421 TV Show (枚举)
  5. Winform TreeList递归绑定树节点
  6. root密码
  7. BZOJ1070 修车-费用网络流
  8. ios开发--animation flash动画
  9. 前N个自然数的随机置换
  10. Servlet的一些API使用介绍
  11. HBase笔记--安装及启动过程中的问题
  12. 最简单易懂的webService客户端之soap+xml请求
  13. Element type &quot;bean&quot; must be followed by either attribute specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.
  14. Python 基础【二】 上
  15. idea怎么创建properties文件
  16. tomcat自动重新加载应用
  17. myeclipse 2014 专业版 安装 svn插件
  18. IDA修改游戏
  19. linux系统中关于shell变量$*与$@的区别
  20. jenkins Error performing command: git ls-remote -h

热门文章

  1. Linux操作大全
  2. mov 与 lea 区别
  3. Access denied for user &#39;root&#39;@&#39;localhost&#39;问题的解决
  4. Java面试题整理(转载)
  5. 性能分析 | JVM发生内存溢出的8种原因及解决办法
  6. 括号序列模型--序列dp--U86873 小Y的精灵国机房之旅
  7. vuex中的babel编译mapGetters/mapActions报错解决方法
  8. js中bind解析
  9. Android中图片优化
  10. easyUI之练习