์ ์ฒด ๊ธ
-
[Python] 15686 ์นํจ ๋ฐฐ๋ฌAlgorithm/๋ฐฑ์ค 2023. 2. 16. 17:27
1. ๋ฌธ์ ๐ https://www.acmicpc.net/problem/15686 15686๋ฒ: ์นํจ ๋ฐฐ๋ฌ ํฌ๊ธฐ๊ฐ N×N์ธ ๋์๊ฐ ์๋ค. ๋์๋ 1×1ํฌ๊ธฐ์ ์นธ์ผ๋ก ๋๋์ด์ ธ ์๋ค. ๋์์ ๊ฐ ์นธ์ ๋น ์นธ, ์นํจ์ง, ์ง ์ค ํ๋์ด๋ค. ๋์์ ์นธ์ (r, c)์ ๊ฐ์ ํํ๋ก ๋ํ๋ด๊ณ , rํ c์ด ๋๋ ์์์๋ถํฐ r๋ฒ์งธ ์นธ www.acmicpc.net 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ 1. dfs๋ฅผ ์ด์ฉํ์ฌ M๊ฐ์ ์นํจ ์ง ๊ณ ๋ฅด๊ธฐ 2. ์นํจ ๊ฑฐ๋ฆฌ๋ ์ง๊ณผ ๊ฐ์ฅ ๊ฐ๊น์ด ์นํจ์ง ์ฌ์ด์ ๊ฑฐ๋ฆฌ์ด๋ค. -> ๊ฐ๊ฐ์ ์ง๊ณผ ์คํํ ์นํจ ์ง ์ค์์ ๊ฐ์ฅ ๊ฐ๊น์ด ์นํจ์ง ๊ฑฐ๋ฆฌ๋ฅผ ๊ตฌํ๊ธฐ 3. ๋์์ ์นํจ ๊ฑฐ๋ฆฌ๋ ๋ชจ๋ ์ง์ ์นํจ ๊ฑฐ๋ฆฌ์ ํฉ์ด๋ค. -> for ๋ฌธ์ ๋์๊ฐ๋ฉฐ ์นํจ ๊ฑฐ๋ฆฌ์ ํฉ์ ๊ตฌํ๊ธฐ ์ด๋ป๊ฒ ๊ณ ๋ฅด๋ฉด, ๋์์ ์นํจ ๊ฑฐ๋ฆฌ๊ฐ..
-
[Python] 2096 ๋ด๋ ค๊ฐ๊ธฐAlgorithm/๋ฐฑ์ค 2023. 2. 10. 17:49
1. ๋ฌธ์ ๐ https://www.acmicpc.net/problem/2096 2096๋ฒ: ๋ด๋ ค๊ฐ๊ธฐ ์ฒซ์งธ ์ค์ N(1 ≤ N ≤ 100,000)์ด ์ฃผ์ด์ง๋ค. ๋ค์ N๊ฐ์ ์ค์๋ ์ซ์๊ฐ ์ธ ๊ฐ์ฉ ์ฃผ์ด์ง๋ค. ์ซ์๋ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ์ค์ ํ๋๊ฐ ๋๋ค. www.acmicpc.net 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ ์๋ฌด๋ฆฌ ์๊ฐํด๋ ๋ก์ง์ ๋ง๋ ๊ฑฐ ๊ฐ์๋ฐ ์๊พธ ๋ฉ๋ชจ๋ฆฌ ์ด๊ณผ๊ฐ ๋ ์ ์ง๋ฌธ๊ฒ์ํ์ ์ฐธ๊ณ ํ๋ค ์๊ณ ๋ณด๋ ์ ๋ ฅ๋ถ๋ถ ๋๋ฌธ์ ๋ฌธ์ ์๋ค ใ ก3ใ ก ์ด ๊ธ(https://www.acmicpc.net/board/view/82973)์ ๋ณด๊ณ ๊ทธ ๋ถ๋ถ๋ง ์์ ํ๋ ์ ๋ต์ฒ๋ฆฌ๊ฐ ๋๋ค ์ ๋ ฅ๊ฐ์ ํฌ๊ณ , ํ์ฌ min๊ณผ max๊ฐ์ ๊ทธ ์ ์์น๊ฐ ์ํฅ์ ์ฃผ๋ฏ๋ก dp๋ผ๊ณ ์๊ฐ๋์ด์ dp ๋ฐฉ์์ผ๋ก ์ ๊ทผํ..
-
[Python] 1806 ๋ถ๋ถ ํฉAlgorithm/๋ฐฑ์ค 2023. 2. 10. 15:19
1. ๋ฌธ์ ๐ https://www.acmicpc.net/problem/1806 1806๋ฒ: ๋ถ๋ถํฉ ์ฒซ์งธ ์ค์ N (10 ≤ N < 100,000)๊ณผ S (0 < S ≤ 100,000,000)๊ฐ ์ฃผ์ด์ง๋ค. ๋์งธ ์ค์๋ ์์ด์ด ์ฃผ์ด์ง๋ค. ์์ด์ ๊ฐ ์์๋ ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถ๋์ด์ ธ ์์ผ๋ฉฐ, 10,000์ดํ์ ์์ฐ์์ด๋ค. www.acmicpc.net 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ ํฌํฌ์ธํฐ์ ์์ฉ๋ฌธ์ ์ด๋ค ์ ๋ ฅ์ด 100,000์ด ๋ค์ด์ค๋๊น ์ด์คํฌ๋ฌธ ๋๋ฆฌ๋ฉด ์๊ฐ์ด๊ณผ๋ ๊ฒ์ด๋ค ํฌํฌ์ธํฐ ๊ฐ๋ ๋ง ์๋ค๋ฏ ์ฝ๊ฒ ํธ๋ ๋ฌธ์ ์ด๋ค 4. ์์ค์ฝ๋ ๐ป import sys input = sys.stdin.readline N, S = map(int, input().strip().split()) arr = list(map(int, inp..
-
[Python] 2457 ๊ณต์ฃผ๋์ ์ ์Algorithm/๋ฐฑ์ค 2023. 2. 3. 20:54
1. ๋ฌธ์ ๐ https://www.acmicpc.net/problem/2457 2457๋ฒ: ๊ณต์ฃผ๋์ ์ ์ ์ฒซ์งธ ์ค์๋ ๊ฝ๋ค์ ์ด ๊ฐ์ N (1 ≤ N ≤ 100,000)์ด ์ฃผ์ด์ง๋ค. ๋ค์ N๊ฐ์ ์ค์๋ ๊ฐ ๊ฝ์ด ํผ๋ ๋ ์ง์ ์ง๋ ๋ ์ง๊ฐ ์ฃผ์ด์ง๋ค. ํ๋์ ๋ ์ง๋ ์๊ณผ ์ผ์ ๋ํ๋ด๋ ๋ ์ซ์๋ก ํํ๋๋ค. ์๋ฅผ ๋ค์ด์, www.acmicpc.net 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ ์ด ๋ฌธ์ ๋ ์กฐ๊ฑด์ด 2๊ฐ์ง์ด๋ค ์ฒ์์ ๋ ์ง๊ณ์ฐ์ ์ผ์ผํ ํ๋ ๋ฐ๋์ ๋ถ๊ธฐ๋ฌธ์ด ํท๊ฐ๋ ค์ ์ดํ์ด๋์ก๊ณ ์์๋ค; ๊ตฌ๊ธ๋ง์ ํตํด ํํธ๋ฅผ ์ป๊ณ ๋ค์ ๋ด ๋ก์ง์ผ๋ก ํ์ด๋ดค๋น ์กฐ๊ฑด1) 3/1 ~ 11/30 ๊น์ง ๋งค์ผ ํ๊ฐ์ง ๊ฝ ๋ ์ง๋ ์ * 100์ ํด์ฃผ์ด ๋น๊ต๊ฐ ์ฝ๋๋ก ๋ฐ๊ฟ์ฃผ์๋ค ๋ํ, 3/1 ์ผ ์ด์ ์ ์ฌ์ ์์๋ ๊ฝ์ 301 ์ผ๋ก ํต์ผํด์ฃผ..
-
[Python] 2847 ๊ฒ์์ ๋ง๋ ๋์ค์ดAlgorithm/๋ฐฑ์ค 2023. 1. 31. 14:15
1. ๋ฌธ์ ๐ https://www.acmicpc.net/problem/2847 2847๋ฒ: ๊ฒ์์ ๋ง๋ ๋์ค์ด ํ๊ต์์ ๊ทธ๋ํฝ์ค ์์ ์ ๋ค์ ๋์ค์ด๋ ์์ ์๊ฐ์ ๋ค์ ๋ด์ฉ์ ๋ฐํ์ผ๋ก ์ค๋งํธํฐ ๊ฒ์์ ๋ง๋ค์๋ค. ๊ฒ์์๋ ์ด N๊ฐ์ ๋ ๋ฒจ์ด ์๊ณ , ๊ฐ ๋ ๋ฒจ์ ํด๋ฆฌ์ดํ ๋ ๋ง๋ค ์ ์๊ฐ ์ฃผ์ด์ง๋ค. ํ๋ ์ด์ด www.acmicpc.net 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ ์ ์๋ฅผ ๋ด๋ฆฌ๋ ๊ฒ์ ์ต์ํ์ผ๋ก ํ๋ ๋ฐฉ๋ฒ์ ๋ค์ ์ซ์๊ฐ 1์ด ๋ ํฌ๋ฉด ๋๋ค → ๊ทธ๋ฆฌ๋ ๋๋ while ๋ฌธ์ ๋๋ ค๊ฐ๋ฉฐ ํ๋์ฉ -1์ ํด์ฃผ๊ณ ๋ง์ง๋ง์ ๋ฆฌ์คํธ๋ฅผ ์ ๋ถ ์ํํ๋ฉฐ ๋ค์ ์ซ์๊ฐ ํฐ ์ง ๋ค์ ์ฒดํฌ๋ฅผ ํด์ฃผ์๋ค. ๋ง๊ธดํ์ง๋ง, ๋ ์ข์ ๋ฐฉ๋ฒ์ด ์์ ๊ฒ๊ฐ์ ๊ตฌ๊ธ๋งํด๋ณด์๋ค! ๋ค๋ฅธ ์ฌ๋๋ค ์ฝ๋๋ฅผ ๋ณด๋ ๋ค์๋ถํฐ ๋ฆฌ์คํธ๋ฅผ ์ํํ๋ฉฐ ๋ค์ ๊ฐ๋ณด๋ค 1๋งํผ ..
-
[Python] 1439 ๋ค์ง๊ธฐAlgorithm/๋ฐฑ์ค 2023. 1. 31. 10:15
1. ๋ฌธ์ ๐ https://www.acmicpc.net/problem/1439 2. ์ ์ถ๋ ฅ ์ ๐ 3. ์๊ณ ๋ฆฌ์ฆ โ ์ต์ ํ์๋ฅผ ๊ตฌํ๊ธฐ ์ํด์ ๊ฐ์ฅ ์ ์ ๋ญํ ์ด๋ฅผ ๋ค์ง์ด์ผํ๋ค → ๊ทธ๋ฆฌ๋ ์๋ฅผ ๋ค์ด 0001100 ์ด๋ฉด ๋ญํ ์ด๋ก ์๋ฅด๊ฒ ๋๋ฉด 0์ 2๊ฐ๊ณ 1์ 1๊ฐ์ด๋ฏ๋ก 1๋ง ๋ค์ง์ผ๋ฉด ์ต์ํ๋์ด ๋ ๊ฒ์ด๋ค ๋ฐ๋ผ์, 1. ๋ญํ ์ด๋ก ์๋ผ์ฃผ๊ณ (0, 1, 0) 2. ๊ทธ ๊ฐฏ์๋ฅผ ์ธ์ด ๊ฐ์ฅ ์์ ๊ฒ์ ํ๋ฆฐํธํด์ฃผ๋ฉด ๋๋ค 4. ์์ค์ฝ๋ ๐ป import sys N = list(sys.stdin.readline().strip()) # ๋ญํ ์ด๋ก ์๋ผ์ค stack = [N[0]] for i in range(1, len(N)): if N[i - 1] != N[i]: stack.append(N[i]) zero_count = sta..
-
java: cannot access org.springframework.boot.SpringApplication์ฝ์ง๋ชจ์/์๋ฌํด๊ฒฐ 2023. 1. 28. 18:16
ํด๋น ์คํ๋ง๋ถํธ ๋ฒ์ ๊ณผ ์๋ฐ ๋ฒ์ ์ด ๋ง์ง ์์ ์๊ธฐ๋ ์๋ฌ์๋ค ์์์ ์๋ ค์ค ๊ฒฝ๋ก์์ spring-boot๊น์ง ๋ก ์ด๋ ํ๋ค์, rm -r [์ญ์ ํ ์คํ๋ง๋ถํธ ๋ฒ์ ]์ ์ด์ฉํด์ ์ญ์ ํด์ฃผ์๋ค. ๊ทธ๋ฆฌ๊ณ pom.xml์ ์๋ ์คํ๋ง ๋ถํธ ๋ฒ์ ์ ๋ฎ์ถฐ์ฃผ์๋ค(์๋ฐ 8๋ฒ์ ์ ์ด์ฉํ๊ณ ์์ด์, 2.2.1๋ก ๋ด๋ ค์ฃผ์๋ค) ์ค๋ฅธ์ชฝ maven update๋ฅผ ์ด์ฉํด ๋น๋ํด์ฃผ๋ฉด ๋!
-
[Spring Security] ์คํ๋ง ์ํ๋ฆฌํฐ ์ฃผ์ ์ํคํ ์ฒDev/์ ๋ฆฌ 2023. 1. 20. 19:53
์๋ ๋ด์ฉ์ Core Spring Security ์คํ๋ง ์ํ๋ฆฌํฐ ๊ธฐ๋ณธ API & Filter ์ดํด๋ฅผ ์๊ฐ ํ, ์ ๋ฆฌํ ๋ด์ฉ์ ๋๋ค. ์ ์ฒด์ ์ธ Spring Security์ ์ ์ฒด์ ์ธ ์ํคํ ์ฒ์ ๋์๊ณผ์ ์ ๋ํ๋ ๊ฒ์ด๋ค. 3๊ฐ์ง ํํ์ Spring Security ๋์๊ณผ์ ์ ์ดํด๋ณผ ๊ฒ์ด๋ค. 1) ์ฌ์ฉ์๊ฐ ์ฒ์ ์ธ์ฆ์ ์๋ํ๋ ๊ฒฝ์ฐ 2) ์ธ์ฆ ํ ์์์์ฒญํ๋ ๊ฒฝ์ฐ 3) ์ฒซ๋ฒ์งธ ์ฌ์ฉ์๊ณผ ๋์ผํ ๊ณ์ ์ผ๋ก ๋ก๊ทธ์ธ์ ์๋ํ๋ ๊ฒฝ์ฐ 1. ์ฌ์ฉ์๊ฐ ์ฒ์ ์ธ์ฆ์ ์๋ํ๋ ๊ฒฝ์ฐ 1. SecurityContextPersistenceFilter SecurityContextPersistenceFilter ๋ด๋ถ์ ์๋ loadContext๋ฅผ ์ด์ฉํ์ฌ Session์ ์ ์ฅ๋ ์ด๋ ฅ์ด ์๋์ง ์ฒดํฌํ๋ค. ์ฒ์ ๋ก๊ทธ์ธ์ ์๋ํ์๊ธฐ ๋๋ฌธ์ ..