Penalty
Penalty
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述
As is known to us, the penalty is vitally important to competitors in the programming contest! After participating in the 2014 ACM-ICPC Asia Xian Regional Contest, LYH have a deep understanding about the importance of penalty. If some teams have solved same problem, the less penalty, the top rank.
According to the rules of the competition, among all the teams, 10% will win a gold medal, 20% will win a silver medal, 30% will win a bronze medal. If it is not an integer, we will take the integer which not less than the real number as the number of the corresponding medal. For example, if the number of gold medal is 2.3, then we consider the number of gold medal is 3.
For the sake of simpleness, suppose that the number of problems each team have solved is equal in the end of the programming contest, and we have known the penalty of each team. As a competitor , LYH want to know what is the maximum penalty will be if he wants to win a gold medal、a silver medal、a bronze medal.
输入
The first line of the input gives the number of test cases, T. T test cases follow.
For each test case, the first line contains an integer n(5≤n≤310), the number of the team except LYH’team, the second line contains n distinct integers a(500≤a≤5500), the ith integer represents the penalty of the ith team except his team.
输出
For each test case, output one line “Case #x: G S B”, where x is the case number(starting from 1), G is the maximum penalty if he wants to win a gold medal, S is the maximum penalty if he wants to win a silver medal, B is the maximum penalty if he wants to win a bronze medal.
样例输入
2
9
500 550 600 650 700 750 800 850 900
10
500 511 522 533 544 555 566 577 588 599
样例输出
Case #1: 499 599 749
Case #2: 510 543 587
来源
原创
我的代码:
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int T,i;
int ji=;
int jin,yin,tong,a1,a2,a3;
int b[];
cin>>T;
while(T--)
{
int n;
cin>>n; //总队伍数是n+1
if((n+)%==)
jin=(n+)/; //金牌数
else
jin=(n+)/+; //金牌数
if((n+)%==)
yin=(n+)/; //银牌数
else
yin=(n+)/+; //银牌数
if((n+)*%==)
tong=(n+)*/; //铜牌数
else
tong=(n+)*/+; //铜牌数
for(i=;i<n;i++)
{
cin>>b[i]; //输入除了LYH'team队伍的penalty值
}
sort(b,b+n); //从小到大排序
a1= b[jin-]-; //想获得金牌最低也要必须比现在除LYH'team队伍的第一名的penalty少1
a2=b[jin+yin-]-;
a3=b[jin+yin+tong-]-;
printf("Case #%d: %d %d %d\n",ji,a1,a2,a3);
ji=ji+;
}
return ;
}
Penalty的更多相关文章
- 一种利用 Cumulative Penalty 训练 L1 正则 Log-linear 模型的随机梯度下降法
Log-Linear 模型(也叫做最大熵模型)是 NLP 领域中使用最为广泛的模型之一,其训练常采用最大似然准则,且为防止过拟合,往往在目标函数中加入(可以产生稀疏性的) L1 正则.但对于这种带 L ...
- 惩罚因子(penalty term)与损失函数(loss function)
penalty term 和 loss function 看起来很相似,但其实二者完全不同. 惩罚因子: penalty term的作用是把受限优化问题转化为非受限优化问题. 比如我们要优化: min ...
- 浅谈RAID写惩罚(Write Penalty)与IOPS计算
介绍 通常在讨论不同RAID保护类型的性能的时候,结论都会是RAID-1提供比较好的读写性能,RAID-5读性能不错,但是写入性能就不如RAID-1,RAID-6保护级别更高,但写性能相对更加差,RA ...
- cdoj 25 点球大战(penalty) 模拟题
点球大战(penalty) Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/2 ...
- 一个用 Cumulative Penalty 培训 L1 正规 Log-linear 型号随机梯度下降
Log-Linear 模型(也叫做最大熵模型)是 NLP 领域中使用最为广泛的模型之中的一个.其训练常採用最大似然准则.且为防止过拟合,往往在目标函数中增加(能够产生稀疏性的) L1 正则.但对于 ...
- 【转载】RAID写惩罚(Write Penalty)与IOPS计算
浅谈RAID写惩罚(Write Penalty)与IOPS计算 Character is what you are in the dark. 暗处最能反映一个人真正品格. ---------Apri ...
- CF&&CC百套计划2 CodeChef December Challenge 2017 Penalty Shoot-out
https://www.codechef.com/DEC17/problems/CPLAY #include<cstdio> #include<algorithm> using ...
- Wasserstein GAN最新进展:从weight clipping到gradient penalty,更加先进的Lipschitz限制手法
前段时间,Wasserstein GAN以其精巧的理论分析.简单至极的算法实现.出色的实验效果,在GAN研究圈内掀起了一阵热潮(对WGAN不熟悉的读者,可以参考我之前写的介绍文章:令人拍案叫绝的Was ...
- SSL Labs: Increased Penalty When TLS 1.2 Is Not Supported
https://community.qualys.com/blogs/securitylabs/2015/05/22/ssl-labs-increased-penalty-when-tls-12-is ...
随机推荐
- kvm在线磁盘扩展
1,查看指定kvm虚拟机的现有磁盘domblklist
- spoj 7258 Lexicographical Substring Search (后缀自动机)
spoj 7258 Lexicographical Substring Search (后缀自动机) 题意:给出一个字符串,长度为90000.询问q次,每次回答一个k,求字典序第k小的子串. 解题思路 ...
- 填充Z形二维数组
形如 1 3 4 10 2 5 9 11 6 8 12 15 7 13 14 16 的数组称谓Z形二维数组.填充这样的数组其实只要按照Z形进行行走填充即可,设置一个flag指示方向,行 ...
- WPF 采用Border创建圆角
通过设置可以创建圆角border的CornerRadius属性其边框呈现圆角样式 代码: <Border Height="50" Background="Red&q ...
- Unity3d 要点板书
WWW.unity3d.com.cn Unity Project unity的项目文件/专案 Scene unity的场景文件 Scene 场景视窗 Game 预览视窗 H... 物件视窗 Pro ...
- phoenegap3.5 采坑
上周5晚上在家看Node.js视频的时候,老大来一条短信让研究下 phoengap打包一个web网站. 遂 陷入了phonegap的深渊中. phoengap很早开始使用 cli模式安装开发环境 ,借 ...
- 怎么增加照片的KB大小
之前都是要想办法压缩图片的大小 今天有人发来一张1.8MB的图片让我帮忙调到30MB左右 一下子放大这么多着实有点茫然 之后想到了一个办法 首先把图片占用体积变大,是不会增加清晰度的,而减小占用体积却 ...
- Win32下C++遍历目录和文件的源码
#include<windows.h> #include<iostream> #include<string> using namespace std; //只能处 ...
- 用VIM删除空行
从网上找了一个 :g/^s*$/d 开始用的挺好,后来遇到一种空格开头的空行,就不好用了. MSDN上说正则匹配空行用/^\s*$/,就试着把上面的命令改为: :g/^\s*$/d 就可以了. 用的操 ...
- 红豆带你从零学C#系列之:开始C#编程(一)
让我们开始学习C#编程吧 作者:红豆西米露 交流QQ:937802080 前面的文章里给大家介绍了C#语言的一些基本认识,现在我们来开始做一个小程序吧! 在这里以我们以“控制台应用程序”来作演示. P ...