입국심사 - 43238
import java.util.*;
class Solution {
public long solution(int n, int[] times) {
long answer = -1;
Arrays.sort(times);
long start = 0; long end = (long)times[times.length-1]*n + 1;
while(start < end) {
long mid = (start+end)/2;
long human = 0;
for(int time : times) { human += (mid / time); }
if(human < n) { start = mid+1; }
else if(human >= n) { end = mid; answer = mid; }
}
if(answer == -1) { answer = times[times.length-1] * n; }
return answer;
}
}
*다른 분들의 코드를 참고하여 작성했습니다