【CF MEMSQL 3.0 A. Declined Finalists】

本文介绍了一种算法,用于解决比赛中前25名选手可能存在的弃权情况,通过已知进入决赛的选手排名,计算出最少有多少人拒绝了参赛邀请。题目要求输出满足这些选手进入决赛条件下的最小弃权人数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

time limit per test 2 seconds

memory limit per test 256 megabytes

input standard input

output standard output

This year, as in previous years, MemSQL is inviting the top 25 competitors from the Start[c]up qualification round to compete onsite for the final round. Not everyone who is eligible to compete onsite can afford to travel to the office, though. Initially the top 25 contestants are invited to come onsite. Each eligible contestant must either accept or decline the invitation. Whenever a contestant declines, the highest ranked contestant not yet invited is invited to take the place of the one that declined. This continues until 25 contestants have accepted invitations.

After the qualifying round completes, you know K of the onsite finalists, as well as their qualifying ranks (which start at 1, there are no ties). Determine the minimum possible number of contestants that declined the invitation to compete onsite in the final round.

Input

The first line of input contains K (1 ≤ K ≤ 25), the number of onsite finalists you know. The second line of input contains r1, r2, ..., rK(1 ≤ ri ≤ 106), the qualifying ranks of the finalists you know. All these ranks are distinct.

Output

Print the minimum possible number of contestants that declined the invitation to compete onsite.

Examples

input

25
2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 28

output

3

input

5
16 23 8 15 4

output

0

input

3
14 15 92

output

67

Note

In the first example, you know all 25 onsite finalists. The contestants who ranked 1-st, 13-th, and 27-th must have declined, so the answer is 3.

 

【翻译】一场比赛本来只选择排名前25位的人进入决赛。但是这些人可以有人弃权,如果一个人弃权,那么就在剩下没有入围的人中选出最高分并邀请他参加决赛。当然这个人也可以拒绝,那么就要一直重复上述过程。给出n个人的排名(1<=n<=25),且这n个人都进入决赛了,请求出满足这些人进决赛,最少有多少个人拒绝参加决赛。

 

题解:
     ①题意很难懂。

     ②转化后问题:给出n个数,求最大值,如果最大值大于25输出最大值-25的值,否则输出0。

#include<stdio.h>
using namespace std;
int n,a,b;
int main()
{
	scanf("%d",&n);
	while(n--)scanf("%d",&b),a=a<b?b:a;	
	printf("%d",a<25?0:a-25);return 0;
}//Paul_Guderian

 

转载于:https://www.cnblogs.com/Damitu/p/7701678.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值