-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA 1017 - The Rank.java
36 lines (32 loc) · 1000 Bytes
/
A 1017 - The Rank.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int [] [] data = new int [input.nextInt()] [4];
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < 4; j++) {
data [i][j] = input.nextInt();
}
}
int [] mark = new int [data.length];
int t = 0,count = 1;
for (int i = 0; i < mark.length; i++) {
mark [i] = 0;
for (int j = 0; j < 4; j++) {
mark [i] = mark [i] + data [i][j];
}
if(i == 0){
t = mark[i];
}
}
Arrays.sort(mark);
for (int i = mark.length-1; i >= 0; i--) {
if ( t == mark [i]){
break;
}
count++;
}
System.out.println(count);
}
}