dh-winternagi 님의 블로그
(11478) 서로 다른 부분 문자열의 개수 본문
https://www.acmicpc.net/problem/11478
단계별로 풀어보기
14단계(집합과 맵) 8번째

#include <iostream>
#include <set>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string str;
set<string> s;
cin >> str;
for(int i=0;i<str.length();i++){
for(int j=1;i+j<=str.length();j++){
s.insert(str.substr(i, j));
}
}
cout << s.size();
return 0;
}'백준 (C++) > Solve' 카테고리의 다른 글
| (13241) 최소공배수 (0) | 2026.04.14 |
|---|---|
| (1934) 최소공배수 (0) | 2026.04.14 |
| (1269) 대칭 차집합 (0) | 2026.04.14 |
| (1764) 듣보잡 (0) | 2026.04.14 |
| (10816) 숫자 카드 2 (0) | 2026.04.14 |
