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的更多相关文章

  1. 一种利用 Cumulative Penalty 训练 L1 正则 Log-linear 模型的随机梯度下降法

    Log-Linear 模型(也叫做最大熵模型)是 NLP 领域中使用最为广泛的模型之一,其训练常采用最大似然准则,且为防止过拟合,往往在目标函数中加入(可以产生稀疏性的) L1 正则.但对于这种带 L ...

  2. 惩罚因子(penalty term)与损失函数(loss function)

    penalty term 和 loss function 看起来很相似,但其实二者完全不同. 惩罚因子: penalty term的作用是把受限优化问题转化为非受限优化问题. 比如我们要优化: min ...

  3. 浅谈RAID写惩罚(Write Penalty)与IOPS计算

    介绍 通常在讨论不同RAID保护类型的性能的时候,结论都会是RAID-1提供比较好的读写性能,RAID-5读性能不错,但是写入性能就不如RAID-1,RAID-6保护级别更高,但写性能相对更加差,RA ...

  4. cdoj 25 点球大战(penalty) 模拟题

    点球大战(penalty) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/2 ...

  5. 一个用 Cumulative Penalty 培训 L1 正规 Log-linear 型号随机梯度下降

      Log-Linear 模型(也叫做最大熵模型)是 NLP 领域中使用最为广泛的模型之中的一个.其训练常採用最大似然准则.且为防止过拟合,往往在目标函数中增加(能够产生稀疏性的) L1 正则.但对于 ...

  6. 【转载】RAID写惩罚(Write Penalty)与IOPS计算

    浅谈RAID写惩罚(Write Penalty)与IOPS计算 Character is what you are in the dark. 暗处最能反映一个人真正品格. ---------Apri ...

  7. CF&&CC百套计划2 CodeChef December Challenge 2017 Penalty Shoot-out

    https://www.codechef.com/DEC17/problems/CPLAY #include<cstdio> #include<algorithm> using ...

  8. Wasserstein GAN最新进展:从weight clipping到gradient penalty,更加先进的Lipschitz限制手法

    前段时间,Wasserstein GAN以其精巧的理论分析.简单至极的算法实现.出色的实验效果,在GAN研究圈内掀起了一阵热潮(对WGAN不熟悉的读者,可以参考我之前写的介绍文章:令人拍案叫绝的Was ...

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

随机推荐

  1. js的replace的用法;

    obj.replace("需要替换的字符串","替换后的字符串")

  2. kafka学习(二)-zookeeper集群搭建

    zookeeper概念 ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,它包含一个简单的原语集,分布式应用程序可以基于它实现同步服务,配置维护和命名 服务等.Zookeeper是h ...

  3. Saiku如何固定查询结果table的表头和首列

    在使用saiku查询的时候,当“行”和“列”的维度内容过多时,在查看时只看到数据,不知道是什么数据,维度不清楚,得来回拖动滚动条才行,所以同事提出想要固定“表头”和“首列”. 在网上找了一些现成的插件 ...

  4. iOS深入学习 (Block全面分析)

    本文翻译自苹果的文档,有删减,也有添加自己的理解部分. 如果有Block语法不懂的,可以参考fuckingblocksyntax,里面对于Block 为了方便对比,下面的代码我假设是写在ViewCon ...

  5. js生成验证码并且判断

       <style type="text/css">        .code        {            font-family: Arial;      ...

  6. IOS开发-UIView之动画效果的实现方法(合集)

    http://www.cnblogs.com/GarveyCalvin/p/4193963.html 前言:在开发APP中,我们会经常使用到动画效果.使用动画可以让我们的APP更酷更炫,最重要的是优化 ...

  7. Oracle学习之常见问题处理

    转自:http://blog.csdn.net/liusong0605/article/details/16349121 安装完oracle并启动服务后,通过sqlPlus无法登录,出现如下错误: s ...

  8. YII与Ace Admin 的集成

    目录 一. 前言... 1 二.为什么要使用YII+ace. 1 三.新建YII模块... 1 四.如何修改模板... 3 五.注意的地方... 4 六.整合的不足之处... 4 一. 前言 yii- ...

  9. Java多线程yield

    前言: 前几天复习了一下多线程,发现有许多网上讲的都很抽象,所以,自己把网上的一些案例总结了一下! 一. Thread.yield( )方法: 使当前线程从执行状态(运行状态)变为可执行态(就绪状态) ...

  10. Bash shell使用环境的终端的环境设置:stty

    Bash shell使用环境的终端的环境设置:stty Bash shell使用环境的终端的环境设置:stty stty -a 将当前所有的stty参数列出来 intr:给正在运行的程序发送中断信号 ...