목록2024/12/26 (2)
넘치게 채우기

https://www.acmicpc.net/problem/18353BOJ - 병사 배치하기문제 유형: LIS(Longest Increasing Subsequence), 다이나믹 프로그래밍문제 난이도: Silver II시간 제한: 1초메모리 제한: 256MB 문제N명의 병사가 무작위로 나열되어 있다. 각 병사는 특정한 값의 전투력을 보유하고 있으며, 병사를 배치할 때는 전투력이 높은 병사가 앞쪽에 오도록 내림차순으로 배치를 하고자 한다. 다시 말해 앞쪽에 있는 병사의 전투력이 항상 뒤쪽에 있는 병사보다 높아야 한다.또한 배치 과정에서는 특정한 위치에 있는 병사를 열외시키는 방법을 이용한다. 그러면서도 남아있는 병사의 수가 최대가 되도록 하고 싶다.예를 들어, N=7일 때 나열된 병사들의 전투력이 다음과 같..
https://leetcode.com/problems/target-sum/leetcode - Target Sum문제 유형: 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array nums and an integer target.You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate ..