add lua & complete 14501, 14888

This commit is contained in:
2021-02-16 02:17:54 +09:00
parent f4f2dfd1f6
commit 4f89ab1c51
6 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
N = int(input())
D = [tuple(map(int, input().split())) for i in range(N)]
T = []
def progress(day, cost):
if day == N:
T.append(cost)
return
elif day > N:
return
if D[day][0] == 1:
progress(day + 1, cost + D[day][1])
else:
progress(day + D[day][0], cost + D[day][1])
progress(day + 1, cost)
progress(0, 0)
print(max(T))