From 487ffc8b061594f4ec6ea9b7561a6d5ca0a53513 Mon Sep 17 00:00:00 2001 From: Do Hyeon Seok Date: Thu, 10 Jul 2025 18:03:04 +0900 Subject: [PATCH] 2025-07-10 --- dohyeondol1/README.md | 4 ++- .../20-dohyeondol1.cpp" | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 "dohyeondol1/\353\254\270\354\236\220\354\227\264/20-dohyeondol1.cpp" diff --git a/dohyeondol1/README.md b/dohyeondol1/README.md index 72a972d..70b386b 100644 --- a/dohyeondol1/README.md +++ b/dohyeondol1/README.md @@ -19,4 +19,6 @@ | 15차시 | 2025.05.22 | DFS | [석유 시추](https://school.programmers.co.kr/learn/courses/30/lessons/250136)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/60| | 16차시 | 2025.05.24 | BFS | [토마토](https://www.acmicpc.net/problem/7576)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/61| | 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| \ No newline at end of file + | 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| \ No newline at end of file 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