문제 링크입니다: https://www.acmicpc.net/problem/5218
간단한 문자열 처리 알고리즘 문제였습니다.
#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 j = 0; j < N; j++)
{
string A, B;
cin >> A >> B;
cout << "Distances: ";
for (int i = 0; i < A.length(); i++)
{
int y = B[i] - '0';
int x = A[i] - '0';
if (y - x >= 0)
cout << y - x << " ";
else
cout << y - x + 26 << " ";
}
cout << "\n";
}
return 0;
}
개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
'알고리즘 > BOJ' 카테고리의 다른 글
백준 2857번 FBI (0) | 2018.10.27 |
---|---|
백준 9933번 민균이의 비밀번호 (0) | 2018.10.27 |
백준 5598번 카이사르 암호 (0) | 2018.10.27 |
백준 11656번 접미사 배열 (0) | 2018.10.27 |
백준 1032번 명령 프롬프트 (0) | 2018.10.27 |