์ ์ฒด ๊ธ
-
AWS Error Code: SignatureDoesNotMatch ํด๊ฒฐ๋ฐฉ๋ฒ์ฝ์ง๋ชจ์/์๋ฌํด๊ฒฐ 2022. 5. 2. 19:04
๋ก์ปฌ์์ ์ ์์ ์ผ๋ก ํ์ผ ์ ๋ก๋๊ฐ ๋๋ ๊ฒ์ ํ์ธํ์๋๋ฐ, ์๋ฒ ๋ฐ์ ํ com.amazonaws.services.s3.model.AmazonS3Exception: The request signature we calculated does not match the signature you provided. key๋ฅผ ํ์ธํด๋ณด๋ผ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ์๋ค. ๊ตฌ๊ธ๋ง ํด๋ณด๋ yml์ ์ ํ์ง SecretKey ์ / ๋ % ๊ฐ ์์ผ๋ฉด ์ธ์์ด ์๋๋ ๋ฌธ์ ์ด๋ค. ํด๊ฒฐ๋ฐฉ๋ฒ / ๋ % ๊ฐ ์๋ SecretKey๊ฐ ์์ฑ๋ ๋ ๊น์ง ์ก์ธ์คํค๋ฅผ ๋ง๋ ํ, yml์ ์๋ ํค๋ฅผ ๋ณ๊ฒฝํด์ค๋ค.
-
[์๊ณ ๋ฆฌ์ฆ] ์ต๊ทผ์ ์ ์ ์ฐพ๊ธฐComputer Science/Algorithm 2021. 12. 16. 03:06
์ต๊ทผ์ ์ ์ ์ฐพ๊ธฐ 2์ฐจ์ ํ๋ฉด์์ ์๋ N๊ฐ์ ์ ๋ค ์ค์์ ์๋ก์ ๊ฑฐ๋ฆฌ๊ฐ ๊ฐ์ฅ ๊ฐ๊น์ด ๋ ์ ์ ์ฐพ๋ ๋ฌธ์ ๊ฐ๋จํ ๋ฐฉ๋ฒ ๋ชจ๋ ์์ ๊ฑฐ๋ฆฌ๋ฅผ ๋ชจ๋ ๊ณ์ฐํ์ฌ ๊ฐ์ฅ ๊ฐ๊น์ด ์์ ์ฐพ๋ ๊ฒ ์๊ฐ ๋ณต์ก๋ O(N^2) ์ ๋ ฌ์ ์ฌ์ฉํ ๋ฐฉ๋ฒ ํฉ๋ณ ์ ๋ ฌ ์๊ณ ๋ฆฌ์ฆ์์ ์ฌ์ฉํ๋ ๋ถํ -์ ๋ณต ๊ธฐ๋ฒ์ ์ฌ์ฉ ์๊ฐ ๋ณต์ก๋ O(N log N) ๋ถํ -์ ๋ณต ๊ธฐ๋ฒ์ ์ฌ์ฉํ ์ต๊ทผ์ ์ ์ ์ฐพ๊ธฐ ์๊ณ ๋ฆฌ์ฆ X ์ขํ ๊ฐ์ ์ฌ์ฉํด ์ ์ ์ ๋ ฌํ ๋ค์ ๋ฐ์ผ๋ก ๋๋ ๊ฐ์ฅ ๊ฐ๊น์ด ์์ ์ด๋ฃจ๋ ๋ ์ ์ ๋ชจ๋ ํ์ชฝ ์ ๋ฐ์ ์๋ ์ง ์๋๋ฉด ํ๋๋ ํ์ชฝ ์ ๋ฐ์, ๋ค๋ฅธ ํ๋๋ ๋๋จธ์ง ์ ๋ฐ์ ์์ ๊ฐ์ฅ ๊ฐ๊น์ด ์์ ์ด๋ฃจ๋ ๋ ์ ์ด ๋ถํ ์ (dividing line)์ ๊ฐ๋ก์ง๋ฅด๋ ๊ฒฝ์ฐ ํจ๊ณผ์ ์ผ๋ก ๊ฒ์ฌํ ์ ์๋ ๋ฐฉ๋ฒ์ด ํ์ ์๊ณ ๋ฆฌ์ฆ ๋์ ๊ณผ์ ๋์ ๊ณผ์ ์ ํ๋ก ๋ํ ๋ผ ์๋ ์..
-
[์๊ณ ๋ฆฌ์ฆ] ๊ทธ๋ผํจ ์ค์บ ์๊ณ ๋ฆฌ์ฆComputer Science/Algorithm 2021. 12. 15. 12:28
๊ทธ๋ผํจ ์ค์บ ์๊ณ ๋ฆฌ์ฆ 1972๋ ๋ก๋ ๋ ๊ทธ๋ผํจ์ ์ํด ๊ฐ๋ฐ๋ ์๊ณ ๋ฆฌ์ฆ ์ฃผ์ด์ง ์ ์งํฉ์ผ๋ก๋ถํฐ ๋จ์ ํ์ ๋ค๊ฐํ์ ๋ง๋ ๋ค์, y์ขํ ๊ฐ์ด ๊ฐ์ฅ ์์ ์ ๋ถํฐ ์์ํด ๋ค๊ฐํ์ ๊ผญ์ง์ ๋ค์ ์์๋๋ก ๋ฐฉ๋ฌธํ๋ฉด์ ๋ณผ๋ก ๊ป์ง์ ํฌํจ๋ ์ง ์ฌ๋ถ๋ฅผ ๊ฒ์ฌํ๋ ๊ฒ์ด๋ค. ๋ณผ๋ก ๊ป์ง์ ํฌํจ๋๋์ง ๊ฒ์ฌ ๋ฐฉ๋ฒ p[1], p[2], ..., p[M]์ด ๋ถ๋ถ ๋ณผ๋ก ๊ป์ง์ด๋ผ ํ๊ณ ์๋ก์ด ์ p[i]๋ฅผ ์ถ๊ฐํ๊ณ ์ ํ ๋, ccw(p[M], p[M-1], p[i])≥ 0 ์ด๋ฉด p[M]์ ์ ๊ฑฐ p[M-1], p[M], p[i]๊ฐ ์ฐํ์ ์ด๋ฉด, p[M]์ ์ ๊ฑฐํ๊ณ , ์ขํ์ ์ด๋ฉด p[i]๋ฅผ ํฌํจํ๋ค. ๊ทธ๋ผํจ ์ค์บ ์๊ณ ๋ฆฌ์ฆ ๋์ ๊ณผ์ ๋จผ์ y ์ ์ด ๊ฐ์ฅ ์์ ์ ์ ์ ํํ ํ, ๊ทธ ์ ์์ ๋ถํฐ ๊ฐ์ฅ ์์ ๊ฐ๋๋ฅผ ๋ง๋๋ ์์๋๋ก ๋ฒํธ๋ฅผ ๋งค๊ฒจ์ค๋๋ค. ์ฒ์ ..
-
[์๊ณ ๋ฆฌ์ฆ] ์ต์ ์ด์ง ํ์ ํธ๋ฆฌComputer Science/Algorithm 2021. 12. 14. 20:02
์ต์ ์ด์ง ํ์ ํธ๋ฆฌ ํธ๋ฆฌ ๋ด์ ํค์ ๊ฐ ํค๊ฐ ํ์๋ ํ๋ฅ ์ด ์ฃผ์ด์ ธ ์์ ๋, ๊ทธ ํธ๋ฆฌ์ ํ๊ท ํ์ ๋น์ฉ, ์ฆ ํ๊ท ๋น๊ต ํ์๋ฅผ ๊ณ์ฐํ๊ณ ์ด๋ฅผ ์ต์ํํ๋ ํ์ํธ๋ฆฌ๋ฅผ ๊ตฌ์ถํ๋ ๋ฌธ์ ์ด์ง ํ์ ํธ๋ฆฌ ๋ฃจํธ์ ์ผ์ชฝ ์๋ธํธ๋ฆฌ์ ์๋ ์์์ ํค ๊ฐ์ ๋ฃจํธ๋ณด๋ค ์๊ณ , ๋ฃจํธ์ ์ค๋ฅธ์ชฝ ์๋ธํธ๋ฆฌ์ ์๋ ์์์ ์นด ๊ฐ์ ๋ฃจํธ๋ณด๋ค ํฐ ์ด์ง ํธ๋ฆฌ ์ ํ์ ์ต์ ์ด์ง ํ์ ํธ๋ฆฌ ๊ตฌํ๊ธฐ 1. A[i, j] ํ ์ด๋ธ๊ณผ k ํ ์ด๋ธ์ ๊ทธ๋ ค์ค๋๋ค. Aํ ์ด๋ธ ๋๊ฐ์ ์, ๋ฌธ์ ์์ ์ฃผ์ด์ง ํ๋ฅ ์ Kํ ์ด๋ธ ๋๊ฐ์ ์, ์์๋๋ก ์ด๊ธฐ ๊ฐ์ ์ ์ด์ค๋๋ค. 2. ์ ํ์์ ์ด์ฉํ์ฌ ํ ์ด๋ธ์ ๊ฐ์ ์ฑ์์ค๋๋ค. 3. ์ด์ง ํ์ ํธ๋ฆฌ ๊ทธ๋ฆฌ๊ธฐ - kํ ์ด๋ธ์์ 1ํ ๊ฐ์ฅ ๋งจ ๋ ๊ฐ์ ๊ฐ์ ธ์ต๋๋ค. k[1, 4] = 3 ๊ฐ์ด 3์ด๊ธฐ ๋๋ฌธ์, ์ด๋ 3๋ฒ ๋ ธ๋๊ฐ ์ต์๋จ์์ ..
-
[์๊ณ ๋ฆฌ์ฆ] ์คํธ๋ง ํธ์ง ๊ฑฐ๋ฆฌComputer Science/Algorithm 2021. 12. 14. 19:19
์คํธ๋ง ํธ์ง ๊ฑฐ๋ฆฌ(string edit distance) ๋ ์คํธ๋ง์ ์ ์ฌ๋๋ฅผ ์ธก์ ํ๊ธฐ ์ํด ์ฌ์ฉ Levenshtein distance(LD)๋ผ๊ณ ๋ ํจ ์๋ ์คํธ๋ง์ S, ๋ชฉํ ์คํธ๋ง์ T S๋ฅผ T๋ก ๋ณํํ๋ ๋ฐ ํ์ํ ์ฝ์ , ์ญ์ , ๋์น ์ฐ์ฐ์ ์ต์ ๋น์ฉ ํธ์ง ๊ฑฐ๋ฆฌ๊ฐ ์ปค์ง์๋ก, ๋ ์คํธ๋ง์ ์ ์ฌ๋๋ ๋ฎ์์ง๊ฒ ๋จ ๋ ผ๋ฌธ์ด๋ ๋ณด๊ณ ์์ ํ์ ๊ฒ์ฌ, DNA ์ผ๊ธฐ ์์ด์ ์ ์ฌ๋ ๊ฒ์ฌ ๋ฑ์ ์ฌ์ฉ๋จ ๋์ ๊ณํ๋ฒ์ ์ ์ฉ ์คํธ๋ง ํธ์ง ๊ฑฐ๋ฆฌ ์์๋ฅผ ๋ค์ด ์ค๋ช ํ๊ฒ ์ต๋๋ค. S = GUMBO T = GAMBOL U -> A ๋ก ๊ต์ฒด L ์ ์ถ๊ฐ ๋ฐ๋ผ์, GUMBO๋ฅผ GAMBOL๋ก ๋ณ๊ฒฝํ๋ ์ต์ ํธ์ง ๊ฑฐ๋ฆฌ๋ 2์์ ์ ์ ์์ต๋๋ค. ์คํธ๋ง ํธ์ง ๊ฑฐ๋ฆฌ๋ฅผ ๊ตฌํ๊ธฐ ์ํด์ , ๊ฐ๋จํ ํ๋ก ์์ฑํ์ฌ ๊ตฌํ ์ ์์ต๋๋ค. 1. ์ด๊ธฐ ํ ์ด๋ธ์ ..
-
[์๊ณ ๋ฆฌ์ฆ] ๊ธฐํ ์๊ณ ๋ฆฌ์ฆ - 2์ฐจ์ ํธ๋ฆฌComputer Science/Algorithm 2021. 12. 14. 04:14
2์ฐจ์ ํธ๋ฆฌ ์ด์ง ํธ๋ฆฌ ํํ๋ฅผ ๊ฐ์ง๋ฉฐ, ๋์ ์ผ๋ก ๋ณํํ๋ ํธ๋ฆฌ ๋ฒ์ ํ์์ ํธ๋ฆฌํ๊ฒ ์ฌ์ฉํ ์ ์๋๋ก ๊ธฐํํ์ ๊ณต๊ฐ์ ๋๋ ๋ง๋๋ ๊ณผ์ ์ด์ง ํ์ ํธ๋ฆฌ๋ฅผ ๋ง๋๋ ๊ณผ์ ๊ณผ ์ ์ฌ ์ด์ง ํ์ํธ๋ฆฌ์ ๋ค๋ฅธ ์ ์ ์ด์ง ํธ๋ฆฌ์ ๋ ๋ฒจ์ ๋ฐ๋ผ y์ถ๊ณผ x์ถ์ ๋ฒ๊ฐ์ ๊ฐ๋ฉด์, ํ๋ฒ์ y์ขํ๊ฐ์ ๊ธฐ์ค์ผ๋ก ์ฝ์ ํ๊ณ , ํ๋ฒ์ x์ขํ๊ฐ์ ๊ธฐ์ค์ผ๋ก ์ฝ์ ํ๋ ๊ฒ์ 2์ฐจ์ ํธ๋ฆฌ ๋ง๋๋ ๊ณผ์ 1. ํด๋น ์์น๊ฐ x์ขํ or y์ขํ์ธ์ง ํ์ธ 2. ํด๋น ์์น์ ๋ง๋ ์ขํ์ ์๋ก ์ฝ์ ํ ์ขํ์ ๋น๊ต 3. ์์น ์ ์ 4. x์ขํ or y์ขํ์๋ฆฌ์ธ์ง ํ์ธ 5. ์๋ก์ด ์ขํ๋ฅผ ์๋ง์ ์ขํ๋ชจ์์ผ๋ก ๊ทธ๋ ค์ฃฝ; ํ๋ฒ์ y์ขํ๊ฐ์ ๊ธฐ์ค์ผ๋ก ์ฝ์ ํ๊ณ , ํ๋ฒ์ x์ขํ๊ฐ์ ๊ธฐ์ค์ผ๋ก ์ฝ์ ํด์ผํ๋ฏ๋ก, ์ฝ์ ์ ์ฝ๊ฒ ํ๋ณํ ์ ์๋๋ก ๋ค๋ฅธ ๋ชจ์์ผ๋ก ๊ทธ๋ ค์ค๋๋ค. ์ฝ์ ๊ณผ์ ..
-
[์๊ณ ๋ฆฌ์ฆ] AVL ํธ๋ฆฌComputer Science/Algorithm 2021. 10. 24. 03:26
AVL ํธ๋ฆฌ ๋ฌ์์์ ์ํ์ Adelson - Velskii ์ Landis๊ฐ ๊ณ ์ํ ๋์ด ๊ท ํ ์ด์ง ํ์ ํธ๋ฆฌ ์ค๋ฅธ์ชฝ ์๋ธํธ๋ฆฌ์ ์ผ์ชฝ ์๋ธํธ๋ฆฌ์ ๋์ด ์ฐจ๊ฐ 2์ด์์ด ๋๋ฉด ํ์ ์ ํตํด ํธ๋ฆฌ์ ๋์ด ์ฐจ๋ฅผ 1์ดํ๋ก ์ ์ง ๋์ด์ฐจ = ์ค๋ฅธ์ชฝ ์๋ธํธ๋ฆฌ์ ๋์ด - ์ผ์ชฝ ์๋ธํธ๋ฆฌ์ ๋์ด ์ด์ง ํ์ ํธ๋ฆฌ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๊ธฐ ๋๋ฌธ์ ์ฝ์ ์์ ์ด์ง ํธ๋ฆฌ ์ฒ๋ผ ๋ ธ๋๋ฅผ ์ฝ์ ํ๋ค. AVL ํธ๋ฆฌ์ ๋์ด ์ฐจ AVL ํธ๋ฆฌ์์ ๋ ธ๋ ์ฝ์ ์, ํ์ ์ด ํ์ํ ๊ฒฝ์ฐ 2๊ฐ์ง๊ฐ ์์ต๋๋ค. ๊ฒฝ์ฐ 1: ๋์ด ์ฐจ 2์ธ ๋ ธ๋๋ถํฐ ์ฝ์ ๊ฒฝ๋ก ์ ๊น์ง์ ๋ชจ์์ด 1์์ธ ๊ฒฝ์ฐ -> ๋จ์ผ ํ์ ๋จ์ผ ํ์ : ๊ฐ์ด๋ฐ ์ซ์๊ฐ ์๋ก ์ฌ๋ผ๊ฐ๋ฉด์, ใ ์ ๋ชจ์์ผ๋ก ํ์ ๊ฒฝ์ฐ 2: ๋์ด ์ฐจ 2์ธ ๋ ธ๋๋ถํฐ ์ฝ์ ๊ฒฝ๋ก ์ ๊น์ง์ ๋ชจ์์ด >, ์ด์ค ํ์ ์ด์ค ํ..
-
[Python] 2309 ์ผ๊ณฑ ๋์์ดAlgorithm/๋ฐฑ์ค 2021. 10. 15. 02:43
1. ๋ฌธ์ ๐ 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ 2๋ช ๋ง ์ ์ธํ๋ฉด 100์ด ๋๋, ์ด์ค for๋ฌธ์ ์ด์ฉํ์ฌ ๋ชจ๋ ๊ฒฝ์ฐ์ ์ ์ค, ์ผ๊ณฑ๋ช ์ ํค ํฉ - (๋๊ฐ๋ฅผ ๋ํ ๊ฐ) = 100์ด๋ฉด ๊ทธ ๋๊ฐ๋ง -1๋ก ๋ณ๊ฒฝํด์ฃผ์ด ์ถ๋ ฅํด์ฃผ์๋ค. 4. ์์ค์ฝ๋ ๐ป import sys height_list = [] for i in range(9): height_list.append(int(sys.stdin.readline())) height_sum = sum(height_list) is_exist = False for i in range(len(height_list) - 1): for j in range(i + 1, len(height_list)): if height_sum - (height_list[i] + height_l..