1047 编程团体赛 (20分) 原题链接:传送门 一、题目: 二、解析: AC代码: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int[] troops = new int[1001]; int champion = 0, max = 0; Integer N = Integer.valueOf(in.readLine()); for (int i = 0; i < N; i++) { String[] split = in.readLine().split(" "); String[] front = split[0].split("-"); int id = Integer.valueOf(front[0]); int score = Integer.valueOf(split[1]); troops[id] += score; if (troops[id] > max) { champion = id; max = troops[id]; } } System.out.print(champion+" "+max); } } 相关 PAT - 乙级 - 题解集