#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]);
}
}
}
'JAVA' 카테고리의 다른 글
[백준/자바] 11050 이항계수 (0) | 2022.01.28 |
---|---|
[백준/자바] 2954번 창영이의 일기장 (0) | 2022.01.27 |
[백준/자바] 9933번 민균이의 비밀번호 (0) | 2022.01.25 |
[백준/자바] 2161번 카드1 (0) | 2022.01.24 |
[백준/자바] 1357번 뒤집힌 덧셈 (0) | 2022.01.24 |
댓글