14501. 퇴사
14501번: 퇴사
첫째 줄에 백준이가 얻을 수 있는 최대 이익을 출력한다.
www.acmicpc.net
- 다른 사람 풀이
#n일까지 완료되지 못하는 상담은 시작 x
n=int(input())
time=[]
amount=[]
d=[0]*(n+1)
for i in range(n):
t,p=map(int,input().split())
time.append(t)
amount.append(p)
for i in range(n):
#완료되는 시점이 n+1보다 넘어가면 for문 돌지 않음
for j in range(i+time[i],n+1):
if d[j] < d[i]+amount[i]:
d[j]=d[i]+amount[i]
print(d[n])'코딩테스트 > BOJ' 카테고리의 다른 글
| [백준] [BFS] 4963. 섬의 개수 (0) | 2023.05.02 |
|---|---|
| [백준] [구현] 7568. 덩치 (0) | 2023.05.01 |
| [백준][이진탐색] 2473. 세 용액 (0) | 2023.04.29 |
| [백준] [BFS] 14503. 로봇 청소기 (0) | 2023.04.28 |
| [백준] [구현] 20291. 파일 정리 (0) | 2023.04.28 |