페이지

11575번: Affine Cipher

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


$O(tl)$


#include<cstdio>
int t, a, b;
char s[1000001];
int main() {
    for (scanf("%d", &t); t--;) {
        scanf("%d%d%s", &a, &b, s);
        for (int i = 0; s[i]; i++) printf("%c", (a*(s[i] - 'A') + b) % 26 + 'A');
        puts("");
    }
    return 0;
}

댓글 없음 :

댓글 쓰기