We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b226acf commit 4b6ce5fCopy full SHA for 4b6ce5f
lkhyun/202509/07 PGM LV3 야근 지수.md
@@ -0,0 +1,26 @@
1
+```java
2
+import java.util.*;
3
+class Solution {
4
+ static PriorityQueue<Integer> pq = new PriorityQueue<>((a,b) -> Integer.compare(b,a));
5
+ public long solution(int n, int[] works) {
6
+ long answer = 0;
7
+ for(int i : works){
8
+ pq.offer(i);
9
+ }
10
+ for(int i=0;i<n;i++){
11
+ if(!pq.isEmpty()){
12
+ int cur = pq.poll();
13
+ if(cur > 1){
14
+ pq.offer(--cur);
15
16
+ }else{
17
+ return 0;
18
19
20
+ for(int i : pq){
21
+ answer += i*i;
22
23
+ return answer;
24
25
+}
26
+```
0 commit comments