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.
๐ ๋ฌธ์ ๋งํฌ
BOJ 14719 - ๋น๋ฌผ
โ๏ธ ์์๋ ์๊ฐ
๊ธฐ์ต์ด ์๋จ..
โจ ์๋ ์ฝ๋
1. ๋ฌธ์ ์์ฝ
๊ณ ์ธ ๋น๋ฌผ์ ์์ ์ถ๋ ฅํ๋ค. ๊ฐ์ฅ ๋์ ๋์ด 'h'์,
n
์ด ์ฃผ์ด์ง๊ณ , ์ข์ธก๋ถํฐ ๊ฐ๊ฐ์ ๋์ด๊ฐn
๋ฒ ์ฃผ์ด์ง๋ค.2. ๋ฌธ์ ํ์ด
๋จธ๋ฆฟ์์ผ๋ก ์๊ฐํ์.
์๋๋ ์ข, ์ฐ์ธก์ ๋์ด ์ฐจ์ด๋ฅผ ์ด์ฉํด์ ํ๋ ค๊ณ ํ์๋ค.
๊ทธ๋ฌ๋ค๊ฐ ๋์ด๊ฐ ์ ์ฃผ์ด์ฃผ์์๊น..? ์๊ฐํ๋ค.
๋์ด๋ฅผ ์ด์ฉํด์ ํ ์ ์์ง ์์๊น?
๋์ด๋ฅผ ํ ์นธ์ฉ ๋น๊ตํ์.
ํด๋น ๋์ด๋ณด๋ค ํฐ ๋์ด๊ฐ 2๊ฐ ์ด์ ์๋ค๋ฉด, ์ ๋ค๋ก ์์น๋ฅผ ์ฐพ๊ณ ๊ทธ ์ฌ์ด์ ๋ฎ์ ๋์ด๊ฐ ์๋ ๊ณณ์ count ํด์ result++
3. ์๋ ์ฝ๋
์ ๋ ฅ ๋ถ๋ถ์ ์ ์ธ.
4. ์ต์ข ์ฝ๋
๐ ์๋กญ๊ฒ ์๊ฒ๋ ๋ด์ฉ
์ค๋๋ง์ ์์ํ๊ฒ ์๋ฌด ์ง์ ์์ด ๋จธ๋ฆฌ๋ง ์จ์ ํด๊ฒฐํ์๋ ๋ฌธ์ .
์ด๋ฐ ๋๋๋ ํ์ฑํ ํด์ฃผ๋ ๊ฒ๋ ๋์์ง ์๋ค๊ณ ์๊ฐํฉ๋๋ค.