用map记录并做累加,对key排序后输出 public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(),key=0,ni=0; HashMap<Integer,Integer> mp=new HashMap<Integer,Integer>(); //用map接收输入并累加 while(n-->0){ key=sc.nextInt(); mp.put(key,mp.getOrDefault(key,0)...