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=1;
int jin,yin,tong,a1,a2,a3;
int b[350];
cin>>T;
while(T--)
{
int n;
cin>>n;           //总队伍数是n+1
if((n+1)%10==0)
jin=(n+1)/10;     //金牌数
else
jin=(n+1)/10+1;  //金牌数
if((n+1)%5==0)
yin=(n+1)/5;    //银牌数
else
yin=(n+1)/5+1;    //银牌数
if((n+1)*3%10==0)
tong=(n+1)*3/10;  //铜牌数
else
tong=(n+1)*3/10+1; //铜牌数
for(i=0;i<n;i++)
{
cin>>b[i]; //输入除了LYH'team队伍的penalty值
}
sort(b,b+n); //从小到大排序
a1= b[jin-1]-1; //想获得金牌最低也要必须比现在除LYH'team队伍的第一名的penalty少1
a2=b[jin+yin-1]-1; 
a3=b[jin+yin+tong-1]-1;
printf("Case #%d: %d %d %d\n",ji,a1,a2,a3);
ji=ji+1;
}
return 0;
}

 


转载于:https://www.cnblogs.com/NYNU-ACM/p/4236878.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值