Skip to content

Commit 0a3f193

Browse files
committed
2 parents 37080fd + 9288204 commit 0a3f193

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ algorithm/
6969
| 김지호 | 15000원 |
7070
| 심수연 | 0원 |
7171
| 정건우 | 0원 |
72-
| 공예영 | 33000원 |
72+
| 공예영 | 23000원 |
7373
| 서정우 | 10000원 |
7474
| 허현빈 | 5000원 |
7575

심수연/5주차/260126.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://www.acmicpc.net/problem/11652
2+
3+
import sys
4+
input = sys.stdin.readline
5+
6+
N = int(input())
7+
8+
dict = {}
9+
10+
for i in range(N):
11+
num = int(input())
12+
if num in dict:
13+
dict[num] += 1
14+
else:
15+
dict[num] = 1 # num 이 dict에 없다면 초기화
16+
17+
print(max(dict, key=lambda x: (dict[x], -x))) # 1순위: value값이 큰 것, 2순위: value값이 같다면 정수가 작은 것

정건우/5주차/260126.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//https://www.acmicpc.net/problem/23351
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
import java.util.PriorityQueue;
6+
import java.util.StringTokenizer;
7+
8+
public class BOJ_S3_23351_물주기 {
9+
public static void main(String[] args) throws IOException {
10+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11+
StringTokenizer st = new StringTokenizer(br.readLine());
12+
13+
int N = Integer.parseInt(st.nextToken());
14+
int K = Integer.parseInt(st.nextToken());
15+
int A = Integer.parseInt(st.nextToken());
16+
int B = Integer.parseInt(st.nextToken());
17+
18+
PriorityQueue<Integer> pq = new PriorityQueue<>();
19+
20+
N = N % A == 0 ? N/A : N/A + 1;
21+
22+
for (int i = 0; i < N; i++) {
23+
pq.add(K);
24+
}
25+
26+
int ans = 0;
27+
28+
while (!pq.isEmpty() && ++ans <= pq.peek()) {
29+
pq.add(pq.poll()+B);
30+
}
31+
32+
System.out.println(ans-1);
33+
34+
}
35+
}

0 commit comments

Comments
 (0)