페이지

5218번: 알파벳 거리

https://www.acmicpc.net/problem/5218


$O(tl)$


#include<cstdio>
int t;
char s1[21], s2[21];
int main() {
    scanf("%d", &t);
    while (t--) {
        scanf("%s %s", s1, s2);
        printf("Distances:");
        for (int j = 0; s1[j]; j++) printf(" %d", (s1[j]>s2[j]) * 26 + s2[j] - s1[j]);
        puts("");
    }
    return 0;
}

댓글 없음 :

댓글 쓰기