diff --git a/dohyeondol1/README.md b/dohyeondol1/README.md index d2234fe..697116b 100644 --- a/dohyeondol1/README.md +++ b/dohyeondol1/README.md @@ -10,4 +10,5 @@ | 6차시 | 2025.04.05 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/22| | 7차시 | 2025.04.08 | 트리 | [트리 순회](https://www.acmicpc.net/problem/1991)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/26| | 8차시 | 2025.04.11 | 덱 | [회전하는 큐](https://www.acmicpc.net/problem/1021)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/32| - | 9차시 | 2025.04.30 | 그리디 알고리즘 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/33| \ No newline at end of file + | 9차시 | 2025.04.30 | 그리디 알고리즘 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/33| + | 10차시 | 2025.04.30 | 완전 탐색 | [소수 찾기](https://school.programmers.co.kr/learn/courses/30/lessons/42839)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/37| diff --git "a/dohyeondol1/\352\267\270\353\236\230\355\224\204 \355\203\220\354\203\211/3-dohyeondol.cpp" "b/dohyeondol1/\352\267\270\353\236\230\355\224\204 \355\203\220\354\203\211/3-dohyeondol1.cpp" similarity index 100% rename from "dohyeondol1/\352\267\270\353\236\230\355\224\204 \355\203\220\354\203\211/3-dohyeondol.cpp" rename to "dohyeondol1/\352\267\270\353\236\230\355\224\204 \355\203\220\354\203\211/3-dohyeondol1.cpp" diff --git "a/dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/2-dohyeondol.cpp" "b/dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/2-dohyeondol1.cpp" similarity index 100% rename from "dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/2-dohyeondol.cpp" rename to "dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/2-dohyeondol1.cpp" diff --git "a/dohyeondol1/\354\231\204\354\240\204 \355\203\220\354\203\211/10-dohyeondol1.cpp" "b/dohyeondol1/\354\231\204\354\240\204 \355\203\220\354\203\211/10-dohyeondol1.cpp" new file mode 100644 index 0000000..a94f4a8 --- /dev/null +++ "b/dohyeondol1/\354\231\204\354\240\204 \355\203\220\354\203\211/10-dohyeondol1.cpp" @@ -0,0 +1,31 @@ +#include +#include +#include +#include +#include +using namespace std; + +bool isPrime(int num) { + if(num < 2) return false; + for(int i = 2; i <= sqrt(num); i++) + if(num % i == 0) return false; + return true; +} + +int solution(string numbers) { + int answer = 0; + set numberSet; + + sort(numbers.begin(), numbers.end()); + do { + for(int i = 1; i <= numbers.length(); i++) { + int n = stoi(numbers.substr(0, i)); + numberSet.insert(n); + } + } while(next_permutation(numbers.begin(), numbers.end())); + + for(int num : numberSet) + if(isPrime(num)) answer++; + + return answer; +} \ No newline at end of file diff --git "a/dohyeondol1/\354\235\264\353\266\204 \355\203\220\354\203\211/1-dohyeondol.cpp" "b/dohyeondol1/\354\235\264\353\266\204 \355\203\220\354\203\211/1-dohyeondol1.cpp" similarity index 100% rename from "dohyeondol1/\354\235\264\353\266\204 \355\203\220\354\203\211/1-dohyeondol.cpp" rename to "dohyeondol1/\354\235\264\353\266\204 \355\203\220\354\203\211/1-dohyeondol1.cpp"