import java.util.Scanner;
public class 谁考了第k名 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
double[][] arr = new double[n][2];
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
arr[i][j] = sc.nextDouble();
}
}
double[] arr2 = new double[n];
double max = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i==0&&arr[j][1]>max){
max = arr[j][1];
}else if (arr[j][1]>max&&arr[j][1]<arr2[i-1]){
max = arr[j][1];
}
}
arr2[i] = max;
max = 0;
}
for (int i = 0; i < n; i++) {
if (arr[i][1]==arr2[k-1]){
System.out.printf("%.0f ",arr[i][0]); //double,float二位数组输出时会输出科学计数法形式,所以保留0位小数处理
System.out.print(arr2[k-1]);
}
}
}
}
0.0分
2 人评分
【亲和数】 (C语言代码)浏览:530 |
WU-判定字符位置 (C++代码)浏览:1471 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:646 |
Cylinder (C语言描述,蓝桥杯)浏览:1279 |
1118(求助_已解决)浏览:351 |
C二级辅导-温度转换 (C语言代码)浏览:802 |
The 3n + 1 problem (C语言代码)浏览:550 |
排序算法(选择,插入,冒泡)浏览:876 |
整除的尾数 (C语言代码)浏览:853 |
printf基础练习 (C语言代码)浏览:2268 |