Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dohyeondol1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
| 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|
26 changes: 26 additions & 0 deletions dohyeondol1/λ¬Έμžμ—΄/20-dohyeondol1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <iostream>
#include <string>
#include <algorithm>
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;
}