挖掘机技术哪家强 ——模拟

package dxb.com;

import java.util.Scanner;

public class wajuejijkishu {

public static void main(String[] args) {
// TODO Auto-generated method stub
int max=100010;
int []school= new int[max];
Scanner sc= new Scanner(System.in);
int n,schid, score;
n = sc.nextInt();
for(int i=0;i<n;i++){
schid = sc.nextInt();
score = sc.nextInt();
school[schid] +=score;
}
int k=1,MAX=0;
for(int i=1;i<n;i++){
if(school[i]>MAX){
MAX= school[i];
k=i;
}
}
System.out.println(k+" "+MAX);
}

}

猜你喜欢

转载自www.cnblogs.com/dangyunkai/p/10645885.html