작성
·
193
0
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int a = in.nextInt();
int b[][] = new int[a][a];
for(int i =0;i<a;i++){
for(int j =0;j<a;j++){
b[i][j] = in.nextInt();
}
}
Main T = new Main();
System.out.println(T.solution(a, b));
}
private int solution(int a, int[][] b) {
int answer = 0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < a; i++) {
int cnt=0;
for (int j = 0; j < a; j++) {
for (int k = 0; k < 5; k++) {
if (b[i][k] == b[j][k]) {
cnt++;
break;
}
}
}
if (cnt > max) {
max=cnt;
answer=i+1;
}
}
return answer;
}
}