1011 World Cup Betting (20 point(s))

PAT甲级1011解题代码 PAT甲级A1011解题,参考代码 字符串处理与容器的使用。 立即下载

1011 World Cup Betting (20 point(s))

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.1  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.1×2.5×65%−1)×2=39.31 yuans (accurate up to 2 decimal places).

Input Specification:

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 Specification:

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.1 1.6
4.1 1.2 1.1

Sample Output:

T T W 39.31

思路:简单。 

#include<iostream>
using namespace std;
int maxOfArray(double a[],int n){
	int index = 0;
	for(int i=0;i<n;i++){
		if(a[i]>a[index]) index=i;
	}
	return index;
} 
void printRes(int index){
	if(index==0) printf("W ");
	else if(index==1) printf("T ");
	else printf("L ");
}
int main(void){
	double res=1.0;
	double arr[3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			scanf("%lf",&arr[j]);
		}
		int idx=maxOfArray(arr,3);
		printRes(idx);
		res=res*arr[idx];
	}
	printf("%.2f\n",(res*0.65-1)*2.0);
	return 0;
} 

 

利用图层自动识别算法实现CAD到Revit BIM模型的高效转换 - VS2022与AutoCAD2024开发环境配置指南 本文详细介绍了如何配置VS2022与AutoCAD2024开发环境,并利用图层自动识别算法实现CAD图纸到Revit BIM模型的高效自动化转换。通过解析CAD图层的规律性,该算法能智能识别并分类墙、门、窗等构件,提取几何信息并驱动Revit自动创建三维模型,从而将传统繁琐的人工“翻模”工作转化为高效、准确的自动化流程,大幅提升BIM模型创建效率。 阅读详情

相关推荐

TensorFlow GPU版本安装步骤-Windows系统

本文由在Windows下安装TensorFlow GPU版本教程-优快云等整理得到。 目录 1、确认显卡是否支持CUDA 1.1 查看显卡信息 打开“设备管理器”,查看显卡信息,如下图所示: 由上图知,本电脑的显卡为NVIDIA Quadro P400. 1.2 查看支持CUDA的显卡 网址:https://developer.nvidia.com/cuda-gpus 经查询可知,该显卡支持CUDA,如下图所示: 2、安装CUDA 2.1 下载CUDA 网址:https://developer.nvi

x_lingyun的专栏 766

PAT:A1011 World Cup Betting (20 分)

PAT:A1011 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 ...

Ecloss 610

Rockit VDEC解码实战:从零构建高效视频处理流水线

本文详细介绍了Rockit VDEC硬件解码模块在RK3568/RK3588平台的应用实践,涵盖开发环境配置、MPI接口使用、码流发送模式选择、内存管理优化及多路解码系统构建。通过实战案例展示如何利用VDEC实现高效视频处理流水线,显著降低CPU占用率,提升嵌入式多媒体开发效率。

ol789012的博客 305

PAT乙级 1023 组个最小数

#include<iostream> #include<string> #include<map> #include<algorithm> #include<bits/stdc++.h> using namespace std; int main(void){ int n; vector<int> vec; for(int i=0; i<10; i++) { cin>&g.

邹九的个人博客 570

微信小程序启用蓝牙设备特征值变化时的notify功能

注意:这里的serviceUUID、notifyCharacteristicUUID 我会在后面写入数据时做重点说明。isNotifyBLECharacteristic:false, //是否启用蓝牙设备服务特征 notify。二、启用蓝牙设备特征值变化时的notify功能。下一篇 将继续介绍 微信小程序蓝牙设备写入数据。

wsk198726的专栏 1173

GEPA_AIME教程:使用GEPA优化数学问题求解的完整指南

本教程展示了如何使用DSPy框架中的GEPA(Generative Evolutionary Prompt Adaptation)优化器来提升大语言模型在数学竞赛问题(AIME)上的表现。# 创建基础的链式思考程序"""带有详细反馈的评估指标,为GEPA提供学习信号"""try:# 处理解析错误feedback_text = f"最终答案必须是一个有效的整数。你回答了'

步子哥的博客 1387

PAT甲级 1011 World Cup Betting (20 分) 题解

\quad这个题难在题意理解上面,说白了就是给你九个数,三个一组,找出一组中最大的数字并记录下这个数所属类别(W,T,L)。一行是一组。最后把每个组最大的数乘起来,乘0.65,再减去1,最后将所得结果乘2输出。即(max1∗max2∗max3∗0.65−1)∗2(max_1*max_2*max_3*0.65-1)*2(max1​∗max2​∗max3​∗0.65−1)∗2。 #include &...

qq_40438165的博客 1664

YOLOv8改进 | 卷积模块 | 用DWConv卷积替换Conv【轻量化网络】

YOLOv8改进,yolov8,yolov8创新,yolov8涨点

kay_545 7159

PAT 甲级 1011 World Cup Betting

PAT 甲级 1011 World Cup Betting 简单模拟 #include<bits/stdc++.h> using namespace std; int main() { #ifdef LOCAL freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout); #endif double W, T, L, ans = 1; for (int i = 0; i < 3; ++i

桂圆儿的仓库 198

SAP CRP能力计划详细说明操作及相关配置

2、求助朋友同事的希望破灭后,网上找了资料发现在百度搜索的资料基本都是没有说明白什么才产能计划,都没有详细的操作说明,然后用google去搜索了一些相关的文章,好像也没有详细的文章。然后也去SAP的官网搜索了相关的文章,都是文字性的表述,对系统的配置都没有很大的帮助,很久之前有记得在隐身人的博客中有提到CRP的能力计划的文章,然后试着去找了一下相关的文章。5、首先产能排产肯定涉及的就是是能力的问题,能力第一个能想到的就是工作中心中的能力页签,在流程制造中也叫资源,其实都是一个东西。

我小时候很黑的博客 4520

003、高通骁龙Spectra ISP架构深度解析:IFE/BPS/IPE流水线与Chromatix调优实战

摘要: 本文深入解析高通骁龙Spectra ISP架构,重点剖析IFE、BPS、IPE三阶段的流水线协作机制与Chromatix调优实战。通过夜景预览"水波纹"案例,揭示HDR对齐与TNR运动估计的关联性问题,指出ISP调优需关注模块间的时序与带宽约束。文章详解各模块核心功能:IFE负责RAW域处理(HDR合成/校正),BPS专注降噪与细节增强,IPE进行YUV域精处理。针对Chromatix调优,强调参数与寄存器映射关系,并给出LSC网格密度、TNR运动灵敏度、LTM光晕等典型问题的解决方案。最后提出实用

zzfmlxs的博客 233

PAT甲级查找元素1011 World Cup Betting

昨天看了一本书,《你的灯亮着吗》,用一些小例子讲述各种情况下问题解决者面对问题做出的反应,很薄,不到两个小时就看完了, 会反复读。里面有一句话:当你以为你认为问题很好地解决了,其实并没有。正如下面这道题很简单,但显然有更简单的方法。 With the 2010 FIFA World Cup running, football fans the world over were becoming i...

qq_33819508的博客 266

绿米Aqara S1【妙控开关 S1E】版本降级或升级自定义固件的方法

绿米Aqara S1【妙控开关 S1E】版本降级或升级自定义固件的方法

LeeKwen的专栏 2175

1011 World Cup Betting (20 point(s))

code: #include<iostream> using namespace std; int main(){ float a, sum = 1 ; int k; char S[3] = {'W' , 'T' , 'L'};//对应字符表// //输入// for(int i = 0 ; i < 3 ; i ++){ float max = -1.0 ...

Bonstoppo 296

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

1011 World Cup Betting (20point(s))

1011 World Cup Betting (20point(s)) 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 be

佳迪斯的博客 137

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

1011 World Cup Betting (20 point(s))

题解 简单模拟题。 #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;string&gt; using namespace std; string t = "WTL"; int main() { float res = 1.0; for(int i = 0; i &lt; 3; ++i) { int index...

徐伯莱 227

1011 World Cup Betting (20 point(s)) - C语言 PAT 甲级

设计思路: * 输入过程中选择最大赔率,同时累乘最大值

有三只土豆 173

PAT(甲级)1011 World Cup Betting (20point(s))

题目 题目链接 思路 按题意模拟就行了,注意最后输出时的公式; 代码 #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { double a, b, c; double maxx[3]; for(int i = 0; i < 3; i ++){

hjyp的博客 187

1011 World Cup Betting (20)(20 point(s))

problem 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 Af...

weixin_30537391的博客 97

PAT(A) 1011 World Cup Betting (20 point(s))

#include <cstdio> int main(void){ float W, T, L, profit[3], sum; char choose[3]; for(int i = 0; i < 3; i++){ scanf("%f %f %f", &W, &T, &L); if(W > T && W > L) profit[i] = W, c

Anpotan的博客 106

1011 World Cup Betting (20 分) PAT 甲级

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

小渣渣的博客 307

【PAT刷题甲级】1011.World Cup Betting

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

C_greenbird的博客 330

PAT甲级-1011 World Cup Betting

简单模拟 C++

weixin_74092648的博客 370

(PAT甲级)1011 World Cup Betting (简单模拟)

【代码】(PAT甲级)1011 World Cup Betting (简单模拟)

zeng_han_cheng的博客 243

【PAT】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 Afri...

疾风骇客的博客 280
上一篇: 1006 Sign In and Sign Out (25 point(s))
下一篇: 1012 The Best Rank (25 point(s))
coderwait
博客等级 码龄9年 20粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值