1. ๋ฌธ์ ์ถ์ฒ : https://school.programmers.co.kr/learn/courses/30/lessons/87946 ์ ์ ์ ํ์ฌ ํผ๋ก๋ k์ ๊ฐ ๋์ ๋ณ "์ต์ ํ์ ํผ๋ก๋", "์๋ชจ ํผ๋ก๋"๊ฐ ๋ด๊ธด 2์ฐจ์ ๋ฐฐ์ด dungeons ๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋, ์ ์ ๊ฐ ํํํ ์ ์๋ ์ต๋ ๋์ ์๋ฅผ return ํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. 2. ์ฝ๋ #include #include #include using namespace std; //์์ด next_permutation์ ํ์ฉํ์ฌ์ ํ์ด //๊ฒฝ์ฐ์ ์๋ฅผ ๋ค ๊ณ์ฐํ ๋ค์ ์ฐจ๋ก๋ก ๊ฒ์ฆํจ int solution(int k, vector dungeons) { int answer = 0; vector v; // 0๋ถํฐ ๋์ ์ฌ์ด์ฆ๊น์ง ..
[ํ๋ก๊ทธ๋๋จธ์ค] ํผ๋ก๋ C++
1. ๋ฌธ์ ์ถ์ฒ : https://school.programmers.co.kr/learn/courses/30/lessons/87946 ์ ์ ์ ํ์ฌ ํผ๋ก๋ k์ ๊ฐ ๋์ ๋ณ "์ต์ ํ์ ํผ๋ก๋", "์๋ชจ ํผ๋ก๋"๊ฐ ๋ด๊ธด 2์ฐจ์ ๋ฐฐ์ด dungeons ๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋, ์ ์ ๊ฐ ํํํ ์ ์๋ ์ต๋ ๋์ ์๋ฅผ return ํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. 2. ์ฝ๋ #include #include #include using namespace std; //์์ด next_permutation์ ํ์ฉํ์ฌ์ ํ์ด //๊ฒฝ์ฐ์ ์๋ฅผ ๋ค ๊ณ์ฐํ ๋ค์ ์ฐจ๋ก๋ก ๊ฒ์ฆํจ int solution(int k, vector dungeons) { int answer = 0; vector v; // 0๋ถํฐ ๋์ ์ฌ์ด์ฆ๊น์ง ..
2023.10.26