利用TreeMap自排序 进行处理数据然后直接输出即可 import java.util.*; public class Main { public static void main(String[] args){ TreeMap<Integer, Integer> map = new TreeMap<>(); Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for(int i = 0; i < n; i...