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

单词

trophy

英 /'trəʊfɪ/ 美 /trofɪ/

n. 奖品;战利品;纪念品

vt. 用战利品装饰

adj. 显示身份的;有威望的

n. (Trophy)人名;(法)特罗菲

triple

英 /'trɪp(ə)l/ 美 /'trɪpl/

n. 三倍数;三个一组

adj. 三倍的;三方的

vt. 使成三倍

vi. 增至三倍

lottery

英 /'lɒt(ə)rɪ/ 美 /'lɑtəri/

n. 彩票;碰运气的事,难算计的事;抽彩给奖法

odd

英 /ɒd/ 美 /ɑd/

n. 奇数;怪人;奇特的事物

adj. 奇数的;古怪的;剩余的;临时的;零散的

n. (Odd)人名;(英、西、挪、瑞典)奥德

distinct

英 /dɪ'stɪŋ(k)t/ 美 /dɪ'stɪŋkt/

adj. 明显的;独特的;清楚的;有区别的

corresponding

英 /,kɒrɪ'spɒndɪŋ/ 美 /,kɔrə'spɑndɪŋ/

adj. 相当的,相应的;一致的;通信的

v. 类似(correspond的ing形式);相配

题目分析

按照题目给的公式套即可。

具体代码

#include<stdio.h>
#include<stdlib.h> double a[3];
char b[3] = { 'W','T','L' };
double c[3]; int main(void)
{
for (int i = 0; i max)
{
temp = j;
max = a[j];
}
}
printf("%c ", b[temp]);
c[i] = max;
}
double res = (c[0] * c[1] * c[2] * 0.65 - 1) * 2;
printf("%.2lf", res);
system("pause");
}

A1012 The Best Rank (25 分)

题目内容

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we encourage students by emphasizing on their best ranks -- that is, among the four ranks with respect to the three courses and the average grade, we print the best rank for each student.

For example, The grades of C, M, E and A - Average of 4 students are given as the following:

StudentID C M E A

310101 98 85 88 90

310102 70 95 88 84

310103 82 87 94 88

310104 91 91 91 91

Then the best ranks for all the students are No.1 since the 1st one has done the best in C Programming Language, while the 2nd one in Mathematics, the 3rd one in English, and the last one in average.

Input Specification:

Each input file contains one test case. Each case starts with a line containing 2 numbers N and M (≤2000), which are the total number of students, and the number of students who would check their ranks, respectively. Then N lines follow, each contains a student ID which is a string of 6 digits, followed by the three integer grades (in the range of [0, 100]) of that student in the order of C, M and E. Then there are M lines, each containing a student ID.

Output Specification:

For each of the M students, print in one line the best rank for him/her, and the symbol of the corresponding rank, separated by a space.

The priorities of the ranking methods are ordered as A > C > M > E. Hence if there are two or more ways for a student to obtain the same best rank, output the one with the highest priority.

If a student is not on the grading list, simply output N/A.

Sample Input:

5 6

310101 98 85 88

310102 70 95 88

310103 82 87 94

310104 91 91 91

310105 85 90 90

310101

310102

310103

310104

310105

999999

Sample Output:

1 C

1 M

1 E

1 A

3 A

N/A

单词

Linear Algrbra

线性代数

calculus

英 /'kælkjʊləs/ 美 /'kælkjələs/

n. [病理] 结石;微积分学

emphasizing

英 /'emfəsaiziŋ/ 美 /'emfəsaiziŋ/

v. 强调(emphasize的现在分词)

题目分析

我真是太菜了,插入排序写了半天,看来这里要加强。

关于题目其实还好,题目很好懂,就是很麻烦,怎么做都感觉很麻烦,我宁愿做难一点的题,也不想做这种题=-=。

具体代码

#include<stdio.h>
#include<stdlib.h>

struct student
{
int id;
double s[4];
};
char c[4] = { 'A','C','M','E' };
int rank[1000000][4];
int N, M;
struct student *d;

void sort(int n)
{
for (int i = 1; i 0 && d[p-1].s[n]

参考博客

1012 The Best Rank (25 分)

PTA A1011&A1012的更多相关文章

  1. 浙大PTA - - 堆中的路径

    题目链接:https://pta.patest.cn/pta/test/1342/exam/4/question/21731 本题即考察最小堆的基本操作: #include "iostrea ...

  2. 浙大PTA - - File Transfer

    题目链接:https://pta.patest.cn/pta/test/1342/exam/4/question/21732 #include "iostream" #includ ...

  3. ERROR<53761> - Plugins - conn=-1 op=-1 msgId=-1 - Connection Bind through PTA failed (91). Retrying...

    LDAP6.3在DSCC控制台启动实例完成,但是操作状态显示“意外错误”,查看日志如下: 04/May/2016:21:10:39 +0800] - Sun-Java(tm)-System-Direc ...

  4. PTA中提交Java程序的一些套路

    201708新版改版说明 PTA与2017年8月已升级成新版,域名改为https://pintia.cn/,官方建议使用Firefox与Chrome浏览器. 旧版 PTA 用户首次在新版系统登录时,请 ...

  5. PTA分享码-Java

    主要用于Java语法练习,非竞赛类题目.   1. Java入门          959dbf0b7729daa61d379ec95fb8ddb0   2. Java基本语法   23bd8870e ...

  6. C语言第一次实验报告————PTA实验1.2.3内容

    一.PTA实验作业 题目1.温度转换 本题要求编写程序,计算华氏温度100°F对应的摄氏温度.计算公式:C=5×(F−32)/9,式中:C表示摄氏温度,F表示华氏温度,输出数据要求为整型. 1.实验代 ...

  7. PTA题---求两个有序序列中位数所体现的思想。

    ---恢复内容开始--- 近日,在做PTA题目时,遇到了一个这样的题,困扰了很久.题目如下:已知有两个等长的非降序序列S1, S2, 设计函数求S1与S2并集的中位数.有序序列A​0​​,A​1​​, ...

  8. 第十四,十五周PTA作业

    1.第十四周part1 7-3 #include<stdio.h> int main() { int n; scanf("%d",&n); int a[n]; ...

  9. 第七周PTA作业

    第一题: #include<stdio.h> int main() { ; ; ){ sum=sum+i; i++; } printf("sum = %d\n",sum ...

随机推荐

  1. Hive 系列(一)—— Hive 简介及核心概念

    一.简介 Hive 是一个构建在 Hadoop 之上的数据仓库,它可以将结构化的数据文件映射成表,并提供类 SQL 查询功能,用于查询的 SQL 语句会被转化为 MapReduce 作业,然后提交到 ...

  2. Mongodb最基础入门教程

      Mongodb最基础入门教程 如果想了解一下redis的入门教程,可以去看一下我的上一篇博客 Mongodb的安装大家可以参考一下其他博主的博客,这里我就不做介绍了.不过值得注意的是,在Linux ...

  3. cookie、session和application都是些什么神?——图文加案例,不怕你不会,就怕你不看

    cookie.session和application都是些什么神? 前言: 一直想写一篇关于cookie和session的博客,由于种种原因,一直没有整理,这不,今天还就遇到问题了,之前虽然会,但是好 ...

  4. lombok 下的@Builder注解用法

    pom依赖 <dependency> <groupId>org.projectlombok</groupId>            <artifactId& ...

  5. 常用Http status code 如何记

    一直记不住http常用的status code,最近思考可以这样想.http无非就是客户端和服务端之间请求嘛.结果么要么成功,要么失败. 成功了,可以提示信息 -- Informational 1xx ...

  6. JVM内存机制与垃圾收集器总结

    本文目录 1. JVM内存组成结构 2. JVM内存回收 3. 垃圾收集器与算法 4. jdk1.6中class文件结构 5. jdk1.6 1.7 1.8比较 1. JVM内存组成结构 JVM栈由堆 ...

  7. python2和python3的解释器安装

    python环境及安装 主板:人的骨架 用于扩展设备 CPU:人的大脑 用于计算和逻辑处理 硬板:肚子 存储数据(永久存储) C盘···· 内存:存储数据(临时储存) 没有保存会消失 电源:人的心脏 ...

  8. 12 redis搭建主从服务(ubuntu)

    什么是主从服务 一个master可以拥有多个slave,一个slave可以拥有多个slave,如此下去,形成了多级服务器集群架构 master用来写数据, slave用来读数据, 经统计:网站的读写比 ...

  9. LeetCode115不同的子序列

    题目说明在这里就不贴出来了,相信打开这篇文章的小伙伴们肯定都是在刷LeetCode的. 一开始我的想法是dfs+回溯,结果运行超时,一开始我就觉得可能会超时,结果不出所料[手动笑哭]. 后来我想了下d ...

  10. 朋友聚会,下馆子要到哪家饭馆?——单样本T检验帮你找到答案

      聚会时,五花八门的饭馆让人眼花缭乱,应该到哪家店吃呢?除了美味的食物,良好的服务态度也是好饭馆的必备品质,如何判断一家饭馆的服务态度如何?此时可以用单样本T检验来找答案~ 让顾客对A饭馆的服务态度 ...