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 29 30 31 32 33 34 35 36 37 | #include <iostream> #include <string> #include <algorithm> using namespace std; string A, B; int result = 50; // A와 B의 차이 최소값 void solve(){ for(int i = 0; i <= B.length() - A.length(); i++){ int count = 0; for(int j = 0; j < A.length(); j++){ if(A[j] != B[i + j]) count++; } result = min(result, count); } cout<<result; } void input(){ cin>>A>>B; } int main(void){ ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); input(); solve(); return 0; } | cs |
'Problem-solving > 백준' 카테고리의 다른 글
백준 - 한수(1065번) (Python3) (0) | 2020.05.13 |
---|---|
백준(Baekjoon) 1541 C++ (0) | 2020.02.27 |
백준(Baekjoon) 2875 C++ (0) | 2020.02.24 |
백준(Baekjoon) 2217 C++ (0) | 2020.02.24 |
백준(Baekjoon) 5585 C++ (0) | 2020.02.17 |
댓글