01: Who took the k-name personal blog: doubleq. win, doubleq. win

Source: Internet
Author: User

01: Who took the k-name personal blog: doubleq. win, doubleq. win
Blog: doubleq. win01: who got the k name?

  • View
  • Submit
  • Statistics
  • Question
Total time limit:
1000 ms
 
Memory limit:
65536kB
Description

In one test, each student's score is different. Now I know the student ID and score of each student, and I want to obtain the student ID and score of the k-th Student.

Input
The first row has two integers: the number of students n (1 ≤ n ≤ 100), and the number of students k (1 ≤ k ≤ n ).
There are n rows of data. Each row includes a student ID (integer) and a score (floating point number), separated by a space.
Output
The student ID and score for the k-th Student are output, separated by spaces. (Note: Use % g to output the score)
Sample Input
5 390788001 67.890788002 90.390788003 6190788004 68.490788005 73.9
Sample output
90788004 68.4

 1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 using namespace std; 5 int n,k; 6 struct s 7 { 8     int xh; 9     double cj;10 }a[1001];11 int comp(const s &a,const s &b)12 {13     return a.cj>b.cj;14 }15 int main()16 {17     cin>>n>>k;18     for(int i=1;i<=n;i++)19     {20         cin>>a[i].xh;21         cin>>a[i].cj;22     }23     sort(a+1,a+n+1,comp);24     printf("%d ",a[k].xh);25     printf("%g",a[k].cj);26     return 0;27 }

 

Related Article

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.