We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5585e8 commit d18f801Copy full SHA for d18f801
1 file changed
BasicLevel_Java/1047 编程团体赛 (20 分).java
@@ -0,0 +1,23 @@
1
+import java.io.BufferedReader;
2
+import java.io.IOException;
3
+import java.io.InputStreamReader;
4
+
5
+public class Main {
6
+ public static void main(String[] args) throws IOException {
7
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8
+ int n = Integer.parseInt(br.readLine());
9
+ int[] res = new int[1001];
10
+ int max = res[0];
11
+ int index = 0;
12
+ for (int i = 0; i < n; i++) {
13
+ String[] str0 = br.readLine().split(" ");
14
+ String[] str1 = str0[0].split("-");
15
+ res[Integer.parseInt(str1[0])] += Integer.parseInt(str0[1]);
16
+ if (max < res[Integer.parseInt(str1[0])]) {
17
+ max = res[Integer.parseInt(str1[0])];
18
+ index = Integer.parseInt(str1[0]);
19
+ }
20
21
+ System.out.println(index + " " + max);
22
23
+}
0 commit comments