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. CentOS 七 vs CentOS 6的不同

    CentOS 七 vs CentOS 6的不同   CentOS 7 vs CentOS 6的不同(1)桌面系统[CentOS6] GNOME 2.x[CentOS7] GNOME 3.x(GNOME ...

  2. CSV 客座文章系列: Pruffi 通过 Windows Azure 挖掘社交媒体的强大招聘潜能

    编辑人员注释:今天这篇文章由 Pruffi 创始人 Alena Vladimirskaya 和 Pruffi 的 CTO Alexander Ivanov 联合撰写,介绍了该公司如何使用 Window ...

  3. 使用session插件并且实现登录验证

    var express = require('express'); var cookieParser = require('cookie-parser'); var bodyParser = requ ...

  4. css学习笔记三

    总结一下水平居中和垂直居中的方法,欢迎交流指正,共同进步! 1.水平居中 1.1):行内元素水平居中,在其父类设置text-align:center; 1.2): 块级元素水平居中有三种 第一种:定宽 ...

  5. Let the Balloon Rise(map)

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  6. HDU ACM 1046 Gridland 找规律

    分析:给出一个矩阵.问最短从一个点经过全部点以此回到起点的长度是多少.绘图非常好理解.先画3*4.3*3.4*4的点阵图案.试着在上面用最短路走一走,能够发现当矩形点阵的长宽都是奇数时,最短路中必然有 ...

  7. NYOJ128 前缀式计算(栈的运用)

    题目信息: http://acm.nyist.net/JudgeOnline/problem.php? pid=128 + 2 * + 3 4 5的值就是 37,详见输入输出. 输入 有多组測试数据, ...

  8. c++打印环境变量

    直接上代码:cpp版本 #include <stdio.h> #include <stdlib.h> #include <string.h> extern char ...

  9. 关于bootstrap弹出二级对话框的使用

    弹出二级对话框,即在对话框的基础上再弹出一个对话框.这对于CRM管理类系统来说应用场景很常见.看到网上有关于实现二级弹出框的方法,需要在一级对话框页面上添加不少css样式.其实,完全可以不用这么麻烦. ...

  10. 关于K-Means算法

    在数据挖掘中,K-Means算法是一种cluster analysis的算法,其主要是来计算数据聚集的算法,主要通过不断地取离种子点最近均值的算法. 问题 K-Means算法主要解决的问题如下图所示. ...