# 传送门

https://pintia.cn/problem-sets/994805260223102976/problems/994805277163896832

6
3-10 99
11-5 87
102-1 0
102-3 100
11-9 89
3-2 61

11 176

# 源代码

``````//C/C++实现
#include <iostream>

using namespace std;

int queue[1001];

int main(){
int n;
scanf("%d", &n);
int max = 0, max_index = -1;
for(int i = 0; i < n; ++i){
int queueNo, memberNo, grade;
scanf("%d-%d %d", &queueNo, &memberNo, &grade);
// memberNo没卵用的，就来客串一下
if(queue[queueNo] > max){
max = queue[queueNo];
max_index = queueNo;
}
}
printf("%d %d\n", max_index, max);
return 0;
}
``````
``````//Java实现

public class Main {
public static void main(String[] args) throws Exception{
int n = 0;
try{
n = Integer.valueOf(s);
}catch (Exception e){
System.exit(0);
}
if(n >0 && n <= 10000){
int[] array = new int[1001];
int max = 0,max_index = 0,array_max_index = 0;
int team = 0,no = 0,grade = 0;
for(int i=0;i<n;i++){
String[] arraySs = ss.split(" ");
String[] sp = arraySs[0].split("-");
try {
team = Integer.valueOf(sp[0]);
no = Integer.valueOf(sp[1]);
}catch (Exception e){
System.exit(0);
}
if(team < 1 || team > 1000 || no < 1 || no > 10 || grade < 0 || grade > 100 ){
System.exit(0);
}
if(team > array_max_index){
array_max_index = team;
}
}
for(int k=0;k<array_max_index+1;k++){
if(array[k]>max) {
max = array[k];
max_index = k;
}
}
System.out.println(max_index+" "+max);
}
}
}
``````