Notice
Recent Posts
Recent Comments
Link
목록1965 (1)
clohi 님의 블로그
[BOJ / Python] 1965 : 상자넣기
https://www.acmicpc.net/problem/1965 문제 코드import sysinput = sys.stdin.readlinen = int(input())box = list(map(int, input().split()))dp = [1] * nfor i in range(n): for j in range(i): if(box[i] > box[j]): dp[i] = max(dp[i], dp[j] + 1)print(max(dp)) 문제 풀이 - DP 문제를 봤을 때 DP를 이용해서 최장 증가 부분 수열(LIS, Longest Increasing Subsequence) 문제를 푸는 것과 똑같다. 상자 크기 배열에서 앞에 있는 상자가 뒤에 있는 상자보다 작을 때만..
Algorithm/BOJ
2025. 11. 2. 23:33
