zoukankan      html  css  js  c++  java
  • 【CF MEMSQL 3.0 A. Declined Finalists】

    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
    
  • 相关阅读:
    Begin Example with Override Encoded SOAP XML Serialization
    State Machine Terminology
    How to: Specify an Alternate Element Name for an XML Stream
    How to: Publish Metadata for a WCF Service.(What is the Metadata Exchange Endpoint purpose.)
    Beginning Guide With Controlling XML Serialization Using Attributes(XmlSerializaiton of Array)
    Workflow 4.0 Hosting Extensions
    What can we do in the CacheMetaData Method of Activity
    How and Why to use the System.servicemodel.MessageParameterAttribute in WCF
    How to: Begin Sample with Serialization and Deserialization an Object
    A Test WCF Service without anything of config.
  • 原文地址:https://www.cnblogs.com/Damitu/p/7701678.html
Copyright © 2011-2022 走看看