Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π λ¬Έμ λ§ν¬
https://www.acmicpc.net/problem/11051
βοΈ μμλ μκ°
30λΆ
β¨ μλ μ½λ
ν΄λΉ λ¬Έμ λ μ΄νκ³μμ κ²°κ³Όκ°μ λ°ννλ λ¬Έμ μ λλ€.
λ¬Έμ μ μ λ ₯ κ°μ μ νμ 보면 Nκ³Ό Kλ 1μ΄μ 1000μ΄νμ λλ€.
λ³΄ν΅ μ΄νκ³μλ₯Ό κ³μ°ν λ νν 리μΌμ μ¬μ©ν΄μ νμ§λ§,
νν 리μΌμ λ°λ³΅λ¬Έ νΉμ μ¬κ·λ₯Ό ν΅ν΄ νκ²λλ©΄
μ΅λκ°μ΄ 1000! μ΄ κ°λ₯ν΄μ§λλ€. μ΄λ¬λ©΄.. int, longμΌλ‘λ ν μ μκ² λμ£ .
κ·Έλμ μ΅λν μΆκ°μ μΈ μνμ μ κ·Όμ μ€μ΄λ©΄μ.. κ°λ₯ν λ°©λ²μ΄ 무μμ΄ μμκΉ κ³ λ―Όνλ€κ°.
nCk = (n-1)C(k-1) + (n-1)C(k)λ₯Ό νμ©νκΈ°λ‘ νμ΅λλ€.
μ΄ κ°μ κ²½μ° DPλ‘ μ νμμ λλ©΄ O(n**2) μμ ν΄κ²° κ°λ₯νκ³
1000! κ³Ό κ°μ΄ ν° κ°μ μ κ·Όνλ κ²½μ°λ₯Ό μμ¨ μ μκ²λ©λλ€.
π μλ‘κ² μκ²λ λ΄μ©
DPμ λλμ΄ μΉν΄μ§κΈ° μμνλ κΈ°λΆμ΄μμ΅λλ€ γ