$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; }
#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; }
댓글 없음 :
댓글 쓰기