Skip to content

Commit 54611fe

Browse files
authored
Merge pull request #62 from 24-Algorithm/minjeong
Minjeong / 9월 4주차 / 3문제
2 parents 30273e9 + 507a9e1 commit 54611fe

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from itertools import product
2+
3+
def solution(word):
4+
answer = 0
5+
c_list = ['A', 'E', 'I', 'O', 'U']
6+
dictionary = []
7+
8+
for i in range(1, len(c_list) + 1):
9+
for j in product(c_list, repeat=i):
10+
dictionary.append(''.join(j))
11+
dictionary.sort()
12+
13+
return dictionary.index(word) + 1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
# 초기화
5+
N = int(input()) # 남은 날짜
6+
t = [0] * (N+1) # 걸리는 기간 리스트
7+
p = [0] * (N+1) # 상담 금액 리스트
8+
dp = [0] * (N+1) # DP
9+
for i in range(1, N+1):
10+
t[i], p[i] = map(int, input().split())
11+
12+
# DP 채우기
13+
for i in range(1, N+1):
14+
time, pay = t[i], p[i]
15+
day = i + time - 1
16+
dp[i] = max(dp[i], dp[i-1])
17+
if day <= N:
18+
dp[day] = max(dp[day], dp[i - 1] + pay)
19+
print(dp[-1])
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import heapq
2+
3+
def solution(routes):
4+
routes.sort(key=lambda x:x[0])
5+
6+
answer = 0
7+
h = [30001]
8+
for r in routes:
9+
earliestend = heapq.heappop(h)
10+
if r[0] > earliestend:
11+
answer += 1
12+
h.clear()
13+
else:
14+
heapq.heappush(h, earliestend)
15+
heapq.heappush(h, r[1])
16+
else:
17+
if len(h) != 0:
18+
answer += 1
19+
return answer

0 commit comments

Comments
 (0)