时间限制: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. 配置php扩展memcache

    配置php扩展memcache 环境说明: 系统版本    CentOS 6.9 x86_64         软件版本    nginx-1.12.2        php-5.5.38       ...

  2. PS如何制作超酷3D字效果

    效果图.jpg (24.94 KB) 2008-4-4 21:46 1.打开PS 执行文件-新建-新建550X400像素空白文档 1.jpg (36.69 KB) 2008-4-4 21:46 2.输 ...

  3. 【Spring】使用Filter过滤请求

    原文:http://liujiajia.me/#/blog/details/spring-filter-request-with-filter public class CustomizedFilte ...

  4. ionic准备之angular基础——$watch,$apply,$timeout方法(5)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. ios网络学习------10 原生API文件上传

    使用原生态的api上传文件的实现: #import "MainViewController.h" @interface MainViewController () @propert ...

  6. Django——Model的使用

    Model使用 首先安装MySQL的python连接驱动,windows下安装可下下载,对应python-2.7: https://code.google.com/p/soemin/downloads ...

  7. MySQL性能优化的最佳20+条经验(转)

    今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序 员需要去关注的事情.当我们去设计数据库表结构,对操作数 ...

  8. CALayer的contentsRect

    contentsRect 想像下contentsRect作为层内容的可视区域.内容的矩形区域(x,y,width,height)也是绑定到层的框架上的.contentRect是一个比例值,而不是屏幕上 ...

  9. c#调用WinRAR软件压缩和解压文件

    using System; using System.Collections.Generic; using System.Web; using System.IO; using System.Linq ...

  10. eclipse 创建maven web错误Cannot change version of project facet Dynamic web module to 3.1解决方案

    Dynamic Web Module 选择“3.1”,java选择“1.8”,报错:Cannot change version of project facet Dynamic web module ...