https://www.acmicpc.net/problem/11053
n = int(input())
A = list(map(int, input().split()))
dp = [1] * (n+1)
for i in range(n):
for j in range(i):
if A[i] > A[j]:
dp[i] = max(dp[i], dp[j] + 1)
print(max(dp))
https://www.acmicpc.net/problem/2579
n = int(input())
arr = []
dp = []
for i in range(n):
arr.append(int(input()))
if n == 1:
print(arr[n-1])
elif n == 2:
print(arr[0]+ arr[1])
else:
dp.append(arr[0])
dp.append(arr[0] + arr[1])
dp.append(max(arr[0] + arr[2], arr[1] + arr[2]))
for i in range(3, n):
dp.append(max(dp[i-2]+arr[i], dp[i-3]+arr[i]+arr[i-1]))
print(dp.pop())
https://www.acmicpc.net/problem/9184
import sys
input = sys.stdin.readline
def w(a, b, c):
if a <= 0 or b <= 0 or c <= 0:
return 1
if a>20 or b>20 or c>20:
return w(20, 20, 20)
if dp[a][b][c]:
return dp[a][b][c]
if a<b<c:
dp[a][b][c] = w(a,b,c-1) + w(a, b-1, c-1) - w(a, b-1, c)
return dp[a][b][c]
dp[a][b][c] = w(a-1, b, c) + w(a-1, b-1, c) + w(a-1, b, c-1) - w(a-1, b-1, c-1)
return dp[a][b][c]
dp = [[[0] * 21 for _ in range(21)] for _ in range(21)]
while True:
a, b, c = map(int, input().split())
if a == -1 and b == -1 and c == -1:
break
print(f"w({a}, {b}, {c}) = {w(a,b,c)}")