PATA 1011 World Cup Betting (20)

来源:https://www.cnblogs.com/qiangz/archive/2018/02/13/8447236.html
-Advertisement-
Play Games

1011. World Cup Betting (20) 時間限制 400 ms 記憶體限制 65536 kB 代碼長度限制 16000 B 判題程式 Standard 作者 CHEN, Yue 時間限制 400 ms 時間限制 400 ms 記憶體限制 65536 kB 記憶體限制 65536 kB 代 ...


1011. World Cup Betting (20)

時間限制 400 ms 記憶體限制 65536 kB 代碼長度限制 16000 B 判題程式 Standard 作者 CHEN, Yue

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).

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 Input
1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1
Sample Output
T T W 37.98


#include <cstdio>
#include <algorithm>
using namespace std;
double win[4],tie[4],lose[4];
double maxodd[4];
double maxofthree(double x,double y,double z)
{
	if(x>=z&&x>=y)
		return x;
	else if(y>=x&&y>=z)
		return y;
	else if(z>=x&&z>=y)
		return z;
}
int main()
{
	for(int i = 1;i <= 3; i++)
	{
		scanf("%lf%lf%lf",&win[i],&tie[i],&lose[i]);
		maxodd[i] = maxofthree(win[i],tie[i],lose[i]);
		
	}
	for(int i = 1;i <= 3; i++){
		if(win[i] >= tie[i] && win[i] >= lose[i])	{
			printf("W ");
		}
		else if(tie[i] >= win[i]&&tie[i] >= lose[i])
		{
			printf("T ");
		}
		else if(lose[i] >= win[i]&&lose[i] >= tie[i])
		{
			printf("L ");
		}
	}
	double ans = (maxodd[1]*maxodd[2]*maxodd[3]*0.65-1)*2;
	printf("%.2lf",ans);
	return 0;
}

  


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 引言:CSP(http://www.cspro.org/lead/application/ccf/login.jsp)是由中國電腦學會(CCF)發起的"電腦職業資格認證"考試,針對電腦軟體開發、軟體測試、信息管理等領域的專業人士進行能力認證。認證對象是從事或將要從事IT領域專業技術與技術管理人 ...
  • 本文簡要的介紹類Struts2的Result結果配置、Servlet的API的訪問,以及模型驅動、屬性驅動基本使用示例。 ...
  • https://www.patest.cn/contests/pat-a-practise/1036 ...
  • 本文主要介紹Struts2的基本入門案例,運行流程以及相關配置文件說明等。 ...
  • 1.為什麼會寫memcpy 在之前的應聘筆試上遇到一道筆試題,題目要求實現一個my_memcpy函數。函數原型:void * my_memcpy(void *dst, const void *src, int n); 之前使用的記憶體拷貝函數是標準庫memcpy函數,拿來就用,真沒有對這個函數做過多了 ...
  • (一) WebDriver WebDriver提供許多用來與瀏覽器交互的功能和設置,通過WebDriver的功能和一些方法,來實現與瀏覽器視窗、警告、框架和彈出視窗的交互,它也提供了自動化操作瀏覽器導航欄、設置cookies、截屏等方便我們測試的特性。 (二) WebDriver功能及方法 功能/屬 ...
  • 一、Hibernate的多對多環境搭建 1.1需求分析 在日常生活中,其實不僅僅是一對多的關係,更多的還是多對多的映射關係。比如今天我們要介紹的用戶和角色之間的關係,用戶可以擁有很多角色,同樣的同一個角色可以有很多用戶擔任。這裡我們的需求就是,給使用系統的用戶分配不同的角色,比如業務員,管理員等等的 ...
  • #include #include using namespace std; const int N = 100001; vector school[N];//玩玩vector int sum[N]; int main() { int n,id,score; scanf("%d",&n); for(... ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...