Rokua P1068 fraction Delimit "structure sort"

Source: Internet
Author: User

Title Description

The selection of World Expo Volunteers is in full swing in a city. In order to select the most suitable talent, A city

All the contestants were written and the written scores reached the interview score to enter the interview. Interview Fraction Root

According to the planned admission number of 150%, that is, if the plan to enroll M volunteers, the interview scores of m*150%

(rounded down) the name of the contestant's score, while the final entry to the interview is not less than the test scores of all

Player.

Now, please write a program to delimit the interview scores, and output all the contestants to enter the interview number and the written test into

Performance.

Input output Format input format:

The first line, two integers n,m (5≤n≤5000,3≤m≤n), is separated by a space, which

Medium n Indicates the total number of participants enrolled in the written test, and M indicates the number of volunteers planned to enroll. Input Data Assurance m*150%

is less than or equal to n after rounding down.

The second line to the N+1 line, each line consists of two integers, the middle is separated by a space, respectively, the contestant's registration number K

(1000≤k≤9999) and the contestant's written test scores S (1≤s≤100). Data Guarantee contestant's registration number

Not the same.

Output format:

The first line, there are two integers, separated by a space, the first integer represents the interview fraction, the second integer is

The actual number of contestants entering the interview.

Starting with the second line, each line contains two integers, separated by a space, representing the contestants entering the interview

The registration number and written results, according to the written test results from high to low output, if the results are the same, according to the registration number from small to large

Sequential output.

Input and Output sample input sample #: Copy
6 3 1000 90 3239 88 2390 95 7231 84 1005 95 1001 88
Output Example # #: Replication
Description

"Sample description"

m*150% = 3*150% = 4.5, rounded down to 4. Ensure that 4 people enter the interview with a fraction of 88, but because 88

There is a re-score, so all the scores are equal to 88 of the contestants can enter the interview, so eventually there are 5 people into the interview.

NOIP 2009 Popularization Group second question

"Code":

#include <bits/stdc++.h>using namespacestd;Const intmaxn=1e4+Ten;structnode{intK,s;} A[MAXN];BOOLCMP (node A,node b) {if(a.s==B.S)returna.k<B.K; Else        returnA.s>B.S;}intMain () {intN,m,ave,cnt=0; scanf ("%d%d",&n,&m);  for(intI=1; i<=n;i++) {scanf ("%d%d", &AMP;A[I].K,&AMP;A[I].S);//registration number + written result} sort (a+1, a+n+1, CMP); //m= (m*1.5);Ave =ceil (a[(int) (m*1.5)].S);  for(intI=1; i<=n;i++)    {        if(a[i].s>=Ave) {CNT++; }} printf ("%d%d\n", ave,cnt);  for(intI=1; i<=n;i++)    {        if(a[i].s>=Ave) {printf ("%d%d\n", A[I].K,A[I].S); }    }}
structure Sort

Rokua P1068 fraction Delimit "structure sort"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.