Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[백준/단계별] 동적 계획법 1 #27

Closed
sieunnnn opened this issue Oct 19, 2023 · 3 comments
Closed

[백준/단계별] 동적 계획법 1 #27

sieunnnn opened this issue Oct 19, 2023 · 3 comments
Assignees
Labels
단계별 백준 단계별 문제풀이 백준

Comments

@sieunnnn
Copy link
Owner

단계별 동적 계획법 1 문제풀이 입니다.

@sieunnnn
Copy link
Owner Author

9184

memoization 조건문이 문제의 세번째 조건문 보다 먼저 와야 하는 이유

  • dp[20][21][22] 일 경우 dp[20][20][20] 으로 반환되기 때문에 문제가 되지 않습니다.
  • dp[3][4][5] 와 같은 경우를 생각해봅시다. 이 경우 memoization 이 아래로 가버리면 중복계산을 수행할 수 있습니다.
    • memoization 을 왜 사용하는지 곰곰히 생각해봅시당.

@sieunnnn
Copy link
Owner Author

9461

long 형으로 해야 통과 됩니당.

@sieunnnn
Copy link
Owner Author

2156

  • 범위를 조심해야 합니다.
  • 길이가 2인 경우 dp[3] 은 생성 되지 않습니다.
    • 이 경우 98% 에서 런타임 에러 (ArrayIndexOutOfBounds) 가 나타납니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
단계별 백준 단계별 문제풀이 백준
Projects
None yet
Development

No branches or pull requests

1 participant