-
Notifications
You must be signed in to change notification settings - Fork 0
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
16-Redish03 #68
16-Redish03 #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ μ΄ λ¬Έμ λ μ¬λ°μλλ°...γ γ γ γ 골λ κ³λ¨ μ λ¬Έμ νλ €λ€κ° λ¨Όμ νμλ λ¬Έμ μμ£ .
μ΄λ κ² νλ©΄ λ©λͺ¨λ¦¬λ κ·ΉνμΌλ‘ μλ μ μλ΅λλ€~~~
#include <iostream>
#include <vector>
#define MAX 1000000000
int main() {
int n;
std::cin >> n;
int grid[2][12] = { 0 };
for (int i = 2; i <= 10; i++) {
grid[0][i] = 1;
}
int k = 0;
for (int i = 2; i <= n; i++) {
k = (k == 0);
for (int j = 1; j <= 10; j++) {
grid[k][j] = (grid[!k][j - 1] + grid[!k][j + 1]) % MAX;
}
}
int answer = 0;
for (int i = 1; i <= 10; i++) {
answer += grid[k][i];
answer %= MAX;
}
std::cout << answer;
}
λλ체 μΌλ§λ μλΌλκ±°μΌ...!!γ γ γ γ γ |
μ λΌκ³ μ΄μμΌμ§...! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ€λλ§μ νλ©΄ μλ μ νλκ²λ λκ° μ 맀νκΈ° λ§λ ¨μ΄μ£ .. κ³ μνμ ¨μ΅λλ€!
@@ -0,0 +1,47 @@ | |||
#include <iostream> | |||
#define DVD 1000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νΉμ DVDμλ λ»μ΄ λ°λ‘ μλμ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μλ§ Dividend(νΌμ μ, λλλΉνλ μ)λ₯Ό μλ―Έν΄μ DVDλΌ μ§μ κ² μλκΉ... μΆλ€μ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
divide λ§μ΅λλ€γ
γ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
divideμκ΅°!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ½λ μ λ΄€μ΅λλ€ λ¬Έμ μ΄ν΄νλ κ²λ μ€λκ±Έλ Έλ€μ©.... μ§μ§ dpλ μ΄λ ΅λ€ γ
γ
γ
,,,,
μκ³ νμ
¨μ΅λλ€~
π λ¬Έμ λ§ν¬
μ¬μ΄ κ³λ¨ μ
βοΈ μμλ μκ°
1h
β¨ μλ μ½λ
βλ¬Έμ μ΄ν΄
45656
μ μΈμ ν λͺ¨λ μ리μ μ°¨μ΄κ° 1μ΄λ€. μ΄λ° μλ₯Ό κ³λ¨ μλΌκ³ νλ€.βλ¬Έμ μ κ·Ό
2οΈβ£ 2νΈ
0μ΄λ 9, κ·Έλ¦¬κ³ λλ¨Έμ§ μλ‘ λλλ κΈ°λ³Έμ μΈ μ κ·Όμ κ°λ€.
κ·Έλ¬λ DPκΈ°λ²μ μ μ©νλ€. μ΄ λ, dp λ°°μ΄μλ κΉμ΄μ 맨 λ μμ λ°λ₯Έ κ³λ¨ μμ κ°μλ₯Ό μ μ₯νλ€. μ¦,
dp[κΈΈμ΄ (N)][맨 λ§μ§λ§ μ(M)] = κΈΈμ΄κ° Nμ΄κ³ 맨 λ§μ§λ§ μκ° M μΌ λμ κ³λ¨ μμ κ°μ
κ° λλ€.
μμλ₯Ό ν΅ν΄μ μ΄ν΄ν΄ 보μ. N = 2λΌλ©΄,
κ°μ₯ λ¨Όμ N = 2λ₯Ό 보기 μ μ N = 1μΌ λλ₯Ό λ¨Όμ μκ°ν΄μΌ νλ€.
dp[1][κ° μ리μ] = 1
μ΄ λ κ²μ΄λ€.N = 2 μΌ λλ₯Ό 보μ.
_10
λ§ κ°λ₯νκΈ° λλ¬Έμ, κ°μλdp[N - 1][1]
μ κ°μμ κ°λ€!dp[N][9] = dp[N - 1][8]
κ³Ό κ°λ€.!dp[N][M] = dp[N - 1][M - 1] + dp[N - 1][M + 1]
λ‘ νν ν μ μλ€.μ λ‘μ§μ μλμ κ°μ΄ νν ν μ μλ€.
ν΅μ¬ λ‘μ§
μ 체 μ½λ
π μλ‘κ² μκ²λ λ΄μ©
μ¬λκΉ νλλ λͺ¨λ₯΄κ²λΉ γ γ