[알고리즘] dp - 백준 25644 1904 11060 1309 15486
25644 최대 상승 import sys input = sys.stdin.readline n = int(input()) nums = list(map(int, input().split())) ans, benefit = 0, 0 for i in range(len(nums)-1, -1, -1): benefit = max(benefit, nums[i]) ans = max(ans, benefit - nums[i]) print(ans) 1904 01타일 n = int(input()) dp = [0 for _ in range(n+1)] dp[0] = 1 dp[1] = 1 if n > 1: dp[2] = 2 for i in range(3, n+1): dp[i] = (dp[i-1] + dp[i-2])%15746 prin..
알고리즘
2023. 3. 18. 21:05