时间限制:1 秒

内存限制:32 兆

特殊判题:否

提交:492

解决:219

题目描述:

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.0 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 (4.1*3.0*2.5*65%-1)*2 = 37.98 yuans (accurate up to 2 decimal places).

输入:

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.

输出:

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.

样例输入:
1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1
样例输出:
T T W 37.98

思路:

其实就是一个数学算式。

代码:

#include <stdio.h>
#include <string.h> #define N 3 char mtoc(int m)
{
if (m == 0)
return 'W';
if (m == 1)
return 'T';
return 'L';
} int main(void)
{
int n, i, j;
double a[N][N];
int max[N]; n = N;
while (scanf("%lf", &a[0][0]) != EOF)
{
memset(max, 0, sizeof(max));
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
if (i == 0 && j == 0)
continue;
scanf("%lf", &a[i][j]);
if (a[i][j] > a[i][max[i]])
max[i] = j;
}
} double res = (a[0][max[0]]*a[1][max[1]]*a[2][max[2]]*0.65-1)*2;
printf("%c %c %c %.2lf\n", mtoc(max[0]),
mtoc(max[1]), mtoc(max[2]), res);
} return 0;
}
/**************************************************************
Problem: 1323
User: liangrx06
Language: C
Result: Accepted
Time:0 ms
Memory:912 kb
****************************************************************/

九度OJ 1323:World Cup Betting(世界杯) (基础题)的更多相关文章

  1. 九度OJ 1261:寻找峰值点 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:500 解决:37 题目描述: 给定一个整数序列,该整数序列存在着这几种可能:先递增后递减.先递减后递增.全递减.全递增. 请找出那个最大值的 ...

  2. 九度OJ 1158:买房子 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:1801 解决:1096 题目描述: 某程序员开始工作,年薪N万,他希望在中关村公馆买一套60平米的房子,现在价格是200万,假设房子价格以每 ...

  3. 九度OJ 1083:特殊乘法 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4114 解决:2809 题目描述: 写个算法,对2个小于1000000000的输入,求结果. 特殊乘法举例:123 * 45 = 1*4 + ...

  4. 九度OJ 1065:输出梯形 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5379 解决:2939 题目描述: 输入一个高度h,输出一个高为h,上底边为h的梯形. 输入: 一个整数h(1<=h<=1000 ...

  5. 九度OJ 1064:反序数 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3758 解决:2773 题目描述: 设N是一个四位数,它的9倍恰好是其反序数(例如:1234的反序数是4321) 求N的值 输入: 程序无任 ...

  6. 九度OJ 1063:整数和 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3456 解决:2254 题目描述: 编写程序,读入一个整数N. 若N为非负数,则计算N到2N之间的整数和: 若N为一个负数,则求2N到N之间 ...

  7. 九度OJ 1062:分段函数 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3306 解决:1952 题目描述: 编写程序,计算下列分段函数y=f(x)的值. y=-x+2.5; 0<=x<2 y=2-1. ...

  8. 九度OJ 1052:找x (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7335 解决:3801 题目描述: 输入一个数n,然后输入n个数值各不相同,再输入一个值x,输出这个值在这个数组中的下标(从0开始,若不在数 ...

  9. 九度OJ 1046:求最大值 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:9861 解决:4013 题目描述: 输入10个数,要求输出其中的最大值. 输入: 测试数据有多组,每组10个数. 输出: 对于每组输入,请输 ...

  10. 九度OJ 1031:xxx定律 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6058 解决:3816 题目描述:     对于一个数n,如果是偶数,就把n砍掉一半:如果是奇数,把n变成 3*n+ 1后砍掉一半,直到该数 ...

随机推荐

  1. oracle数据库中函数和存储过程中的区别

    一.函数必须有返回值,过程没有返回值: 二.函数可以单独执行,过程必须通过execute执行: 三.函数可以嵌入SQL中执行,过程不能. 可以将比较复杂的查询写成函数,然后在过程中调用.

  2. input 中 datetime-local 方法

    <input  type=" datetime-local "> 这个标签是H5新增的对象方法 能把现有的时间赋值给它 但是注意:必须是  yyyy-MM-ddTHH: ...

  3. shell通配符、命令代换、引号

    1.通配符 (1)* :匹配多个任意字符 (2)? :匹配一个任意字符 (3)[若干字符] :匹配方括号中任意一个字符的一次出现 2.命令代换:反引号``或者$() 例1:vim test_th.sh ...

  4. javascript event loop

    原文: https://blog.csdn.net/sjn0503/article/details/76087631 简单来讲,整体的js代码这个macrotask先执行,同步代码执行完后有micro ...

  5. sqlmap tamper绕过安全狗

    可以过5.3版本 放出py #!/usr/bin/env python """ Copyright (c) 2006-2014 sqlmap developers (ht ...

  6. Android学习(十) SQLite 基于SQL语句的操作方式

    main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns ...

  7. Fragment简单用法

    一.示意图 二.新建一个左侧碎片布局left_fragment.xml <LinearLayout xmlns:android="http://schemas.android.com/ ...

  8. TortoiseGit 连接oschina不用每次输入username和password的方法

    每次git clone 和push 都要输入username和password.尽管安全.但在本机上每次都输有些麻烦,怎样记住username和password呢? 在网上看了各种方法,太杂,非常多可 ...

  9. Git学习小结

    版本控制工具 集中式: CVS SVN 集大成者 分布式:git 创始人:inux Towards 2005年 工具 最好使用linux(oh-my-zsh) gitbash -> cygwin ...

  10. 转 RabbitMQ

    转自:https://blog.thankbabe.com/2017/08/03/rabbitmq-demo/?from=cnblogs 介绍 RabbitMQ是一个由erlang开发的基于AMQP( ...