HWOJ合并表记录

import java.util.*;
public class Main{
public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n1 = sc.nextInt();  
            int[] arr = new int[1000];
            int temp;
            for(int i=0;i0){
                    arr[temp]+=sc.nextInt();
                }else{
                    arr[temp]=sc.nextInt();
                }
            }
            for(int j=0;j0){
                    System.out.println(j);
                    System.out.println(arr[j]);
                }
            }
        }
        
        sc.close();
    }
}

你可能感兴趣的:(HWOJ合并表记录)