Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- ue5
- XR Interaction Toolkit
- 시뮬레이션
- 재귀
- 유니티
- 스택
- 다이나믹 프로그래밍
- 트리
- 그래프
- 백준
- 브루트포스
- Unreal Engine 5
- 우선순위 큐
- 누적 합
- 그리디 알고리즘
- 다익스트라
- 유니온 파인드
- VR
- DFS
- 투 포인터
- BFS
- 정렬
- 알고리즘
- 수학
- 자료구조
- c++
- 백트래킹
- 문자열
- 구현
- Team Fortress 2
Archives
- Today
- Total
1일1알
백준 2607번 비슷한 단어 C++ 본문
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <limits.h>
#include <bitset>
using namespace std;
using int64 = long long;
int n;
map<char, int> mp;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
string str;
cin >> str;
int len = str.length();
for (int i = 0; i < len; i++) {
mp[str[i]]++;
}
int ans = 0;
for (int i = 0; i < n - 1; i++) {
cin >> str;
int wrongCnt = 0;
map<char, int> tmpMp;
for (auto a : mp) {
tmpMp.insert({ a.first,a.second });
}
for (int j = 0; j < str.length(); j++) {
tmpMp[str[j]]--;
}
for (auto a : tmpMp) {
wrongCnt += abs(a.second);
}
if (str.length() == len) {
if (wrongCnt <= 2) ans++;
}
else {
if (wrongCnt <= 1) ans++;
}
}
cout << ans;
}
'알고리즘' 카테고리의 다른 글
백준 1253번 좋다 C++ (0) | 2022.09.09 |
---|---|
백준 24391번 귀찮은 해강이 C++ (0) | 2022.09.08 |
백준 20291번 파일 정리 C++ (0) | 2022.09.06 |
백준 2146번 다리 만들기 C++ (0) | 2022.09.05 |
백준 1937번 욕심쟁이 판다 C++ (0) | 2022.09.04 |