기억이 안나서 다시 풀었는데 그때보다 더욱 이해가 되었다 처음 temp[0]는 항상 0으로 두고, 3달치와 3달의 min(1달*3이나 1일*plan[pi]*3이나)과 비교하여 풀 수 있었다. #include #include using namespace std; int cost[4], plan[12]; int temp[13]; int dp() { for (int pi = 1; pi < 13; ++pi) { temp[pi] = min(plan[pi-1] * cost[0], cost[1]); } for (int pi = 0; pi < 13; ++pi) { if (pi > 0) temp[pi] += temp[pi - 1]; if (pi > 2) temp[pi] = min(temp[pi], temp[pi-3]+cost[2]); } if (cost[3] < temp[12]) return cost[3]; else return temp[12]; } int ...
원문 링크 : swexpert - 수영장