Skip to content

Commit

Permalink
CT_321
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-Good committed Nov 27, 2024
1 parent da41895 commit 8e303fc
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions BOJ/Java/src/B1/Boj_2160_그림비교.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package B1;

import java.io.*;

public class Boj_2160_그림비교 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

int N = Integer.parseInt(br.readLine());
char[][][] arr = new char[N][5][7];

for (int i = 0; i < N; i++) {
for (int j = 0; j < 5; j++) {
char[] chars = br.readLine().toCharArray();
for (int k = 0; k < 7; k++) {
arr[i][j][k] = chars[k];
}
}
}

int min = 36;
String result = "";

for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j < N; j++) {
int cnt = 0;
for (int k = 0; k < 5; k++) {
for (int l = 0; l < 7; l++) {
if (arr[i][k][l] != arr[j][k][l]) cnt++;
}
}
if (min > cnt) {
min = cnt;
result = (i + 1) + " " + (j + 1);
}
}
}

bw.write(result);
bw.flush();
}
}

0 comments on commit 8e303fc

Please sign in to comment.