링크 : https://www.acmicpc.net/problem/1149
#include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
int rgb[3];
int dp[1001][3];
for(int i = 1; i <= N; i++){
cin >> rgb[0] >> rgb[1] >> rgb[2];
dp[i][0] = min(dp[i-1][1], dp[i-1][2]) + rgb[0];
dp[i][1] = min(dp[i-1][0], dp[i-1][2]) + rgb[1];
dp[i][2] = min(dp[i-1][0], dp[i-1][1]) + rgb[2];
}
cout << min(dp[N][1], min(dp[N][0], dp[N][2]));
return 0;
}