diff --git a/hyeokbini/README.md b/hyeokbini/README.md index 9e0d834..ed8dc8d 100644 --- a/hyeokbini/README.md +++ b/hyeokbini/README.md @@ -21,3 +21,4 @@ | 17차시 | 2025.08.03 | 구현, 재귀 | [별 찍기 - 10](https://www.acmicpc.net/problem/2447)
[별 찍기 - 11](https://www.acmicpc.net/problem/2448) | [#17](https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/59) | | 18차시 | 2025.08.07 | 브루트포스 | [약속 장소](https://www.acmicpc.net/problem/25542)|[#18](https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/66)| | 19차시 | 2025.08.10 | 브루트포스 | [리모컨](https://www.acmicpc.net/problem/1107)|[#19](https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/68)| + | 20차시 | 2025.08.14 | 완전탐색,DFS | [모음사전](https://school.programmers.co.kr/learn/courses/30/lessons/84512)|[#20](https://github.com/AlgoLeadMe/AlgoLeadMe-15/pull/72)| diff --git "a/hyeokbini/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244-\353\252\250\354\235\214\354\202\254\354\240\204/\353\252\250\354\235\214\354\202\254\354\240\204.cpp" "b/hyeokbini/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244-\353\252\250\354\235\214\354\202\254\354\240\204/\353\252\250\354\235\214\354\202\254\354\240\204.cpp" new file mode 100644 index 0000000..eb5f660 --- /dev/null +++ "b/hyeokbini/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244-\353\252\250\354\235\214\354\202\254\354\240\204/\353\252\250\354\235\214\354\202\254\354\240\204.cpp" @@ -0,0 +1,38 @@ +#include +#include + +using namespace std; + +char arr[5] = {'A','E','I','O','U'}; +string checkstring; +int count = -1; // 빈 문자열(제일 초기 상태)에서도 count++가 호출되므로 -1에서 시작해야 함 +int answer; + +void func(string curword) +{ + // 기저조건 - 길이 5 초과되면 return + if(curword.length() > 5) + { + return; + } + + // 호출될 때마다 카운트 증가 + count++; + + if(curword == checkstring) + { + answer = count; + return; + } + + for(int i = 0; i < 5; i++) + { + func(curword + arr[i]); + } +} + +int solution(string word) { + checkstring = word; + func(""); + return answer; +} \ No newline at end of file