https://codeforc.es/gym/102222/my
好像在哪里见过这个东西?字符的左右移还是小心,注意在mod26范围内。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;inline int read() {int x=0;int f=0;char c;do {c=getchar();if(c=='-')f=1;} while(c<'0'||c>'9');do {x=(x<<3)+(x<<1)+c-'0';c=getchar();} while(c>='0'&&c<='9');return f?-x:x;
}inline void _write(int x) {if(x>9)_write(x/10);putchar(x%10+'0');
}inline void write(int x) {if(x<0) {putchar('-');x=-x;}_write(x);putchar('\n');
}void TestCase(int ti);int main() {
#ifdef Yinkufreopen("Yinku.in","r",stdin);//freopen("Yinku.out","w",stdout);
#endif // Yinkuint T=read();for(int ti=1;ti<=T;ti++)TestCase(ti);
}/*--- ---*/char p[60],c[60],p2[60],c2[60];
char t[256];void TestCase(int ti) {int n=read(),m=read();scanf("%s%s%s",p,c,c2);int rightshift=c[0]-p[0];if(rightshift<0)rightshift+=26;for(int i=0;i<m;i++){p2[i]=c2[i]-rightshift;if(p2[i]<'A')p2[i]+=26;}p2[m]='\0';printf("Case #%d: ",ti);puts(p2);
}