分析:
这个题目比较简单,考察了ASCII码的转换和string的操作。
代码(原创)
#include <iostream>
#include <string>
using namespace std;
int main() {
int T;
cin >> T;
while(T--) {
int n, m;
cin >> n >>m;
string s1, s2, x;
cin >> s1 >> s2;
cin >> x;
int c = s2[0] - s1[0];
for(int i = 0 ; i < x.length() ; i++) {
cout << "Case #" << i + 1 << ": " << char ((x[i] -'A' - c + 26) % 26 + 65 ); //强制类型转换
}
}
return 0;
}
测试用例
知识点补充
string库函数
看https://blog.csdn.net/fdqw_sph/article/details/54233971
string.h库函数
看https://blog.csdn.net/zhubin215130/article/details/8993403
ASCII
常见ASCII码的大小规则:0~9<A~Z<a~z
a是:97,A是65大小写相差32 Z是90 z是122
‘1’是 49 ‘0’是48
‘\0’是0 空格32