diff --git a/dohyeondol1/README.md b/dohyeondol1/README.md index f44924f..26f1ff5 100644 --- a/dohyeondol1/README.md +++ b/dohyeondol1/README.md @@ -21,3 +21,4 @@ | 17차시 | 2025.06.26 | 기하학 | [선분 교차 2](https://www.acmicpc.net/problem/17387)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/65| | 18차시 | 2025.07.04 | 기하학 | [Water Testing](https://www.acmicpc.net/problem/16057)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/70| | 19차시 | 2025.07.09 | 그래프 이론 | [최소 스패닝 트리](https://www.acmicpc.net/problem/1197)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/76| + | 20차시 | 2025.07.10 | 문자열 | [접두사](https://www.acmicpc.net/problem/1141)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/78| diff --git "a/dohyeondol1/\353\254\270\354\236\220\354\227\264/20-dohyeondol1.cpp" "b/dohyeondol1/\353\254\270\354\236\220\354\227\264/20-dohyeondol1.cpp" new file mode 100644 index 0000000..3f713dd --- /dev/null +++ "b/dohyeondol1/\353\254\270\354\236\220\354\227\264/20-dohyeondol1.cpp" @@ -0,0 +1,26 @@ +#include +#include +#include +using namespace std; + +string arr[50]; + +int main() { + cin.tie(nullptr)->sync_with_stdio(false); + + int N; + cin >> N; + for(int i = 0; i < N; i++) + cin >> arr[i]; + sort(arr, arr+N); + + int count = N; + for(int i = 0; i < N-1; i++) { + string prefix = arr[i+1].substr(0, arr[i].size()); + if(prefix == arr[i]) + count--; + } + + cout << count << '\n'; + return 0; +} \ No newline at end of file