250x250
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
- union_find
- Union-find
- Properties
- List
- javascript
- GC로그수집
- JPA
- CSS
- string
- math
- scanner
- 리소스모니터링
- 스프링부트
- deque
- NIO
- Calendar
- set
- html
- map
- 힙덤프
- dfs
- 큐
- BFS
- alter
- date
- sql
- Java
- 스택
- priority_queue
- spring boot
Archives
- Today
- Total
매일 조금씩
백준 5218번: 알파벳 거리 본문
728x90
반응형
#include <iostream>
#include <string>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string A, B;
cin >> A >> B;
cout << "Distances: ";
for (int j = 0; j < A.length(); j++) {
int y = B[j] - '0';
int x = A[j] - '0';
if (y - x >= 0)
cout << y - x << " ";
else
cout << y - x + 26 << " ";
}
cout << endl;
}
return 0;
}
728x90
반응형
'알고리즘' 카테고리의 다른 글
백준 1976번: 여행 가자 (0) | 2020.03.08 |
---|---|
백준 1717번: 집합의 표현 (0) | 2020.03.08 |
백준 5555번: 반지 (0) | 2020.02.16 |
백준 5598번: 카이사르 암호 (0) | 2020.02.12 |
백준 11656번: 접미사 배열 (0) | 2020.02.11 |