전형적인 dp문제이다. 각 돌에 도달하기 위한 값들을 잘 정리하면 풀 수 있다. #include #include #include using namespace std; #define MAX 999999; /* three jumps plus 1 (no skip) plus 2 (1 skip) plus 3 (2 skips) -> just one time & k energy */ int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,k; cin >> n; pair energy[21]; for(int i=1; i> x >> y; energy[i] = make_pair(x,y); } cin >> k; /* dp[i][0]은..