Recent Posts
Notice
No Rules Rules
점프 (feat. 백준, 1890번) 본문
728x90
반응형
점프
https://www.acmicpc.net/problem/1890
반응형
// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(NULL);
register int N;
int arr[101][101];
long long dp[101][101];
cin >> N;
for (register int i = 1, j; i <= N; ++i)
for (j = 1; j <= N; ++j)
cin >> arr[i][j], dp[i][j] = 0;
dp[1][1] = 1;
for (register int x = 1, y; x <= N; ++x)
for (y = 1; y <= N; ++y) {
if ((x == N && y == N) || (dp[x][y] == 0))
continue;
register int dist = arr[x][y];
register int down = x + dist;
register int right = y + dist;
if (down <= N)
dp[down][y] = dp[down][y] + dp[x][y];
if (right <= N)
dp[x][right] = dp[x][right] + dp[x][y];
}
cout << dp[N][N] << "\n";
return 0;
}
// *&)*@*
해당 문제는 아래 "Pascal's Travels" 와 동일한 문제입니다.
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
멍멍이 쓰다듬기 (feat. 백준, 1669번) (0) | 2022.09.06 |
---|---|
보드 점프 (feat. 백준, 3372번) (2) | 2022.09.06 |
Pascal's Travels (feat. 백준, 4620번) (0) | 2022.09.06 |
세 부분 (feat. 백준, 2993번) (0) | 2022.09.06 |
단어 나누기 (feat. 백준, 1251번) (0) | 2022.09.06 |
Comments