반응형
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
- @P0
- 처우산정
- msSQL
- 이분탐색
- OFFSET
- 파라메트릭
- 백준
- 경력
- incr
- 연결요소
- 처우협의
- Docker
- 물채우기
- 기술면접
- Kafka
- 13908
- compose
- 오퍼레터
- upper_bound
- boj #19237 #어른 상어
- 퇴사통보
- dfs
- 소프티어
- 성적평가
- BOJ
- BFS
- softeer
- 매개변수탐색
- 6987
- 백트래킹
Archives
- Today
- Total
기술 블로그
1120번 문자열 본문
728x90
반응형
https://www.acmicpc.net/problem/1120
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> #include <map> using namespace std; string A, B; int main(void) { cin >> A; cin >> B; int diff = 0; if (A.length() == B.length()) { for (int i = 0; i < A.length(); i++) { if (A.at(i) != B.at(i)) ++diff; } } else { diff = 100; for (int i = 0; i < B.length(); i++) { int a = 0, b = i, d = 0; if (i + A.length() > B.length()) break; while (a < A.length()) { if (A.at(a) != B.at(b)) ++d; ++a; ++b; } diff = min(diff, d); } } printf("%d\n", diff); return 0; } | cs |
728x90
반응형
'알고리즘 문제 > BOJ' 카테고리의 다른 글
4179번 불! (0) | 2018.12.30 |
---|---|
1019번 책 페이지 (0) | 2018.12.29 |
10448번 유레카 이론 (0) | 2018.12.29 |
7568번 덩치 (0) | 2018.12.29 |
1213번 팰린드롬 만들기 (0) | 2018.12.29 |