JAVA
[백준/자바] 5533번 유니크
동백05
2022. 1. 26. 00:32
#1일1알고리즘 25일차
https://www.acmicpc.net/problem/5533
5533번: 유니크
첫째 줄에 참가자의 수 N이 주어진다. (2 ≤ N ≤ 200) 둘째 줄부터 N개 줄에는 각 플레이어가 1번째, 2번째, 3번째 게임에서 쓴 수가 공백으로 구분되어 주어진다.
www.acmicpc.net
import java.util.Scanner;
public class jan26 {
public static void main(String[] args) {
//BOJ 5533
Scanner s = new Scanner(System.in);
int number = s.nextInt();
Integer arr[][]=new Integer[number][3];
for(int i=0;i<number;i++) {
for(int j=0;j<3;j++) {
arr[i][j]=s.nextInt();
}
}
int score[]=new int[number];
int count=0;
for(int j=0;j<3;j++) {
for(int i=0;i<number;i++) {
count=0;
for(int k=0;k<number;k++) {
if(i!=k && arr[i][j]==arr[k][j]) {
count++;
}
}
if(count==0) score[i]+=arr[i][j];
}
}
for(int i=0;i<number;i++) {
System.out.println(score[i]);
}
}
}