Skip to content

Commit 6b46161

Browse files
committed
Clean up: code
1 parent f08526d commit 6b46161

File tree

1 file changed

+4
-5
lines changed
  • src/main/java/io/github/imsejin/study/baekjoon/silver

1 file changed

+4
-5
lines changed

src/main/java/io/github/imsejin/study/baekjoon/silver/P7568.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.BufferedReader;
44
import java.io.InputStreamReader;
5+
import java.util.Arrays;
56
import java.util.StringTokenizer;
67

78
public class P7568 {
@@ -33,17 +34,16 @@ static int[] solve(String[] members) {
3334
}
3435

3536
int[] ranks = new int[people.length];
37+
Arrays.fill(ranks, 1);
3638

3739
for (int i = 0; i < people.length; i++) {
3840
for (int j = 0; j < people.length; j++) {
3941
if (i == j) continue;
4042

4143
if (people[i].weight < people[j].weight && people[i].height < people[j].height) {
42-
people[i].rank++;
44+
ranks[i]++;
4345
}
4446
}
45-
46-
ranks[i] = people[i].rank;
4747
}
4848

4949
return ranks;
@@ -52,7 +52,6 @@ static int[] solve(String[] members) {
5252
private static class Human {
5353
private final int weight;
5454
private final int height;
55-
private int rank = 1;
5655

5756
private Human(int weight, int height) {
5857
this.weight = weight;
@@ -69,7 +68,7 @@ public static Human from(String expression) {
6968

7069
@Override
7170
public String toString() {
72-
return String.format("Human(weight=%d, height=%d, rank=%d)", weight, height, rank);
71+
return String.format("Human(weight=%d, height=%d)", weight, height);
7372
}
7473
}
7574

0 commit comments

Comments
 (0)