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 ...
随机推荐
- Permutation Recovery(模拟)
Permutation Recovery Time Limit: 10000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- 【菜鸟学习Linux】-第一章-Linux环境搭建-安装VMware虚拟机
本人菜鸟一个,刚毕业才上班2个月,现在用到Linux部署项目,这才开始学习Linux,以下是我在安装Linxu系统是遇到的一些问题,希望能给广大菜鸟们在学习的道路上提供帮助和指导,废话不多说!开工! ...
- Android流式布局实现
查看我的所有开源项目[开源实验室] 欢迎增加我的QQ群:[201055521],本博客client下载[请点击] 摘要 新项目用到了一种全新布局----Android标签流式布局的功能,正好一直说给大 ...
- ovs 实用案例
建立gre,xvlan:http://networkstatic.net/configuring-vxlan-and-gre-tunnels-on-openvswitch/ vm之间通过gre通信:h ...
- oracle超过最大游标数异常分析(转贴)
问题描述 Oracle 使用 OPEN_CURSORS 参数指定一个会话一次最多可以打开的游标的数量.超过此数量时,Oracle 将报告 ORA-01000 错误.当此错误传播到 WebLogic S ...
- Foundation 学习
官网 Foundation是个跟bootstrap齐名的前端框架. 移动优先,响应式,最低支持IE8. html+css+jq构建 网格Grid Basic: .row父容器 子元素类.column ...
- Html5 Video的使用
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Nio Client
public class NIOClient { static int SIZE = 2; final static int bufferSize = 500 * 1024; static InetS ...
- BZOJ 2594: [Wc2006]水管局长数据加强版( LCT )
离线然后就是维护加边的动态MST, Link cut tree秒掉..不过我写+调了好久...时间复杂度O(NlogN + MlogM) ------------------------------- ...
- SGU 187.Twist and whirl - want to cheat( splay )
维护一个支持翻转次数M的长度N的序列..最后输出序列.1<=N<=130000, 1<=M<=2000 splay裸题... ------------------------- ...