1011. World Cup Betting (20)[C语言]
来源:互联网 发布:淘宝页面找不 编辑:程序博客网 时间:2024/06/07 15:52
1011. World Cup Betting (20)
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 L1.1 2.5 1.71.2 3.0 1.64.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).
Input
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.
Output
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.
Sample Input1.1 2.5 1.71.2 3.0 1.64.1 1.2 1.1Sample Output
T T W 37.98
#include <stdio.h>#include <stdlib.h>#include <math.h>int main(){ double a[3][4]; int b[3]; char c[3]={"WTL"}; int i ,j; for(i= 0 ; i < 3 ;i++){ scanf("%lf %lf %lf",&a[i][0],&a[i][1],&a[i][2]); } for(i= 0 ; i < 3 ;i++){ a[i][3] = a[i][0]; b[i]=0; for(j = 0 ; j < 3 ; j++){ if(a[i][3] < a[i][j]){ a[i][3] = a[i][j]; b[i] = j; } } } for(i = 0 ; i < 3 ; i++){ printf("%c " ,c[b[i]]); } double rs = (((a[0][3] * a[1][3] * a[2][3] * 65.00/100.00 -1.0) * 2.0) * 100)/100.00; printf("%.2f" ,rs); return 0;}
- 1011. World Cup Betting (20)[C语言]
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 算法学习笔记--贪婪算法
- java 判断一个数组中的数值是否连续相邻
- C++:虚基类详解
- 关于学习 unity3D 的知识预储备
- 对pair进行排序
- 1011. World Cup Betting (20)[C语言]
- 搞定linux上MySQL编程(六):C语言编写MySQL程序(结)
- 图论_无向图领接表
- Linux下rz/sz安装及使用方法
- centos6.9下安装tomcat8
- ARM汇编指令
- bzoj1098: [POI2007]办公楼biu
- [latex tikz]画无向图的例子
- 起重机(Crane ACMICPC CERC 2013 UVa1611)