分数划分
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.Stack; public class Main { static void sort(int arr[][]){ int temp = 0; int temp1 = 0; for(int i = 0;i < arr.length - 1;i++){ for (int j = 0; j < arr.length - 1; j++) { if(arr[j][1] < arr[j+1][1]){ temp = arr[j][1];temp1 = arr[j][0]; arr[j][1] = arr[j+1][1];arr[j][0] = arr[j+1][0]; arr[j+1][1] = temp;arr[j+1][0] = temp1; } } } int temp2 = 0; for(int i = 0;i < arr.length - 1;i++){ for (int j = 0; j < arr.length - 1; j++) { if(arr[j][0] > arr[j+1][0] && arr[j][1] == arr[j+1][1]){ temp2 = arr[j][0]; arr[j][0] = arr[j+1][0]; arr[j+1][0] = temp2; } } } } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); Stack<Character> st = new Stack<Character>(); int n = sc.nextInt(); int m = sc.nextInt(); int arr[][] = new int[n][2]; for(int i = 0;i < n;i ++){ for (int j = 0; j < 2; j++) { arr[i][j] = sc.nextInt(); } } sort(arr); int peo = (int) ((int)m * 1.5); int k = 0; while(arr[k][1] >= arr[peo - 1][1]){ k++; } System.out.println(arr[k - 1][1] + " " + k); for(int i = 0;i < k;i ++){ for (int j = 0; j < 2; j++) { System.out.printf(arr[i][j] + " "); } System.out.println(); } } }