-
Notifications
You must be signed in to change notification settings - Fork 1
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
12-kjs254 #50
12-kjs254 #50
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.
ν¨λ©μμΌμ νΈλ λ°©λ² μλ‘λ€μ :) μ μΌλ°μ μΈ λ°©μμΈ out_of_bound μ²΄ν¬ λ° λ°©λ¬Έ νμ λ°©λ²μΌλ‘ νμμλλ°...
for i in range(n): | ||
board[i].insert(0,-1) | ||
board[i].append(-1) | ||
board.insert(0,[-1]*(n+2)) | ||
board.append([-1]*(n+2)) |
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.
n = len(board)
board = [[-1, *line, -1] for line in board] # κ° νλ§λ€ 맨 μ, 맨 λ€μ -1 λΆμ
board = [[-1] * (n + 2), *board, [-1] * (n + 2)] # 0ν μ, λ§μ§λ§ ν λ€μ [-1, ...] 1μ°¨μ 리μ€νΈ λΆμ
-1 ν¨λ©μ μλ κ² 2μ€λ‘ ν μ μλ΅λλ€ :)
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.
ν¨λ©μμΌμ νΈλ λ°©λ²μ΄ λκ² μΈμκΉμλ λ¬Έμ μμ΅λλ€. μλ‘κ² λ°©λ² νλλ₯Ό λ°°μκ° μ μμμ΅λλ€.
μνμ μ°μ°μ ν΅νμ¬ ννμ μμΉλ₯Ό 쑰건μμ΄ μ°Ύλ λ°©λ²λ μ κΈ°νμ΅λλ€.
μμ μ λΉμ·ν λ¬Έμ λ₯Ό νλ μ€ μ
λ ₯μ λ°μ λ ννμ μμΉλ₯Ό 미리 κΈ°μ΅μ ν΄λ λ€ ν΄λΉ μμΉμ λνμ¬ μ°μ°μ μνν¨μΌλ‘μ μμμκ°μ μ€μΌ μ μλ λ°©λ²μ΄ μμλ κ²μΌλ‘ κΈ°μ΅νλλ° μ΄ λ¬Έμ μμλ μ μ©κ°λ₯ν κ² κ°λ€λ μκ°μ νμμ΅λλ€.
μκ³ νμ ¨μ΅λλ€. π
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.
ν¨λ©μμΌμ νΈλ κ²λ μΈμ κΉμκ³ , μ λ μ μμ νΉμ±μ μ΄μ©ν΄μ 쑰건문 μ λΆμ΄κ³ *2 -1
λΆμ¬μ νλ건 μ§μ§ λλλ€μ.. μ΄κ±΄ μ λ μμΌλ‘ μμ£Ό μ¨λ¨Ήμ΄μΌκ² μ΅λλ€. μκ³ νμ
¨μ΅λλ€.
π λ¬Έμ λ§ν¬
μμ μ§λ
βοΈ μμλ μκ°
1h
β¨ μλ μ½λ
1. λ¬Έμ ν΄μ
κ΅μ₯ν κ°λ¨ν΄μ λ€μν νμ΄λ°©λ²μ΄ λ²λ©μ΄λ λ¬Έμ λ€μ.
μ κ° λ μ¬λ¦° λ°©λ²μ λ€μμ΄ μμ΅λλ€.
ννμ κ°μμ μμΉλ§μ νμ ν΄μ n2μμ ννμ μνμ§μμ κ°μλ₯Ό λΉΌμ£Όλ λ°©λ²
λ°°μ΄μ νλμ© μννμ¬ ννμ΄ λ°κ²¬λλ€λ©΄ μν μ’μ° λκ°μ μ
-1
μ μ½μ νμ¬0
μ κ°μλ₯Ό μΈλ λ°©λ²λ°°μ΄μ μννμ¬ λμ μν μ’μ° λκ°μ μ ννμ΄ μλμ§ μ²΄νΉνλ©΄μ μ§ννλ λ°©λ²
μνμ μΌλ‘ μ κ·Όνλ 1λ²μ μ°μ°μλκ° λΉ λ₯΄μ§λ§ λ°μ ΈμΌνλ μ‘°κ±΄μ΄ μλΉν ν°λΌ 2λ²μ λ°©λ²μ μ ννμ΅λλ€.
3λ²μ 2λ²κ³Ό μ μ¬ν λ°©λ²μ΄μ§λ§ κ΄ν μκ°λ³΅μ‘λλ§ λ리λ λ°©λ²μ΄λΌ μ¬κΈ°μ μΈ λ°©λ²μ μλκ² κ°λ€μ.
2μ°¨μ λ°°μ΄μ μννλ©° ννμ μνμ’μ°λκ°μ μ λ€μ Έλ³΄λλ‘ νκ² μ΅λλ€.
2. μλμ½λ
μ¬κΈ°μ μ‘°κ±΄μ΄ λͺ κ° λΆμ΅λλ€.
board[i][j]
λ‘ λ°°μ΄μ μ κ·Όμ νλ €λ ννμ μμΉμ λ°λΌ λ²μλ₯Ό λ²μ΄λλ λ¬Έμ κ° μμ΄μ 쑰건μ λΆμ΄κΈ°λ³΄λ€ κ·Έλ₯ ν λ리λ₯Ό κ°μΈμ£Όλκ² νΈν΄λ³΄μ¬μinsert()
,append()
λμν΄μ λ°°μ΄μ κ°μΈμ€¬μ΅λλ€.ν λ리μ μνμ§μμ
-1
μ μ½μ νλ€λ©΄5*5
λ°°μ΄μ λ€μκ³Ό κ°μ λͺ¨μ΅μ΄ λμ΄μμ΄μΌ ν©λλ€.μ΄μ μΈλ±μ± λ²μλ₯Ό λ²μ΄λ κ±±μ μ΄ μμΌλ νμνμ¬ μνμ§μμ
-1
λ‘ μΉνν΄μ£Όκ³ 0μ κ°μλ₯Ό λ°νν©λλ€.νμ§λ§ μ΄λ κ² νλ©΄ μ€λ΅μ λλ€.
ννμ΄ μΈμ ν΄μλ€λ©΄
1
μ΄-1
λ‘ μΉνλμ΄ ννμ μ¨κ²¨λ²λ¦½λλ€.쑰건μ λ¬λ©΄ λ°λ‘ ν΄κ²°λκ² μ§λ§ λ°°μ΄μ κ°μ΄ μ μλΌλ μ μ μ΄μ©νμ¬ μ°μ°λ§μΌλ‘ ν΄κ²°ν μ μμ΅λλ€.
ν¨μ
f(x) = 2x-1
μμf(1) = 1
,f(0) = -1
μ΄λ―λ‘ κ°μ΄1
μΈ ννμ΄ λλ½λ μΌμ΄ μμ΄μ‘μ΅λλ€.νΉμ
0
κ°μ΄ μΆκ°λμ΄ μ λ΅μ μν₯μ μ€κΉ μΆμ§λ§f(0.5) = 0
μ΄κΈ° λλ¬Έμ λ¬Έμ μμ΅λλ€.μ 체 μ½λ
π μλ‘κ² μκ²λ λ΄μ©
νλ‘κ·Έλλ¨Έμ€ μ½λ©ν μ€νΈ μ λ¬Έλ¬Έμ λΌ κ·Έμ μ¬λ°κ² νκΈ°λ§ ν΄μ μλ‘κ² μκ² λ κ²μ μλ€μ
λ€μμ μ μ¬νμ§λ§ λΉμ·ν λ¬Έμ λ‘ κ°μ§κ³ μλ³΄κ² μ΅λλ€!