Skip to content

Commit 64d658a

Browse files
committed
refactor: [CT] 놀이기구 탑승_241007
약 10ms 시간단축
1 parent f282951 commit 64d658a

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

CodeTree/2021-2022년/YJ_놀이기구_탑승.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ else if(likes.contains(ride[x][y])){
115115
return new Student(currentX,currentY,likeCount,blanckCount);
116116
}
117117

118+
static int[] scoreBoard = {0,1,10,100,1000};
118119
static int calculateScore(int currentX, int currentY){
119120
int friendCount = 0;
120121
List<Integer> likes = likeStudents.get(ride[currentX][currentY]);
@@ -128,21 +129,7 @@ static int calculateScore(int currentX, int currentY){
128129
friendCount++;
129130
}
130131
}
131-
return getScore(friendCount);
132-
}
133-
134-
private static int getScore(int friendCount){
135-
switch (friendCount){
136-
case 1:
137-
return 1;
138-
case 2:
139-
return 10;
140-
case 3:
141-
return 100;
142-
case 4:
143-
return 1000;
144-
}
145-
return 0;
132+
return scoreBoard[friendCount];
146133
}
147134

148135
private static boolean stop(int x, int y){

0 commit comments

Comments
 (0)