#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
char x;
int y;
cin >> x >> y;
int x1 = x;
if (x >= 'A'&&x <= 'Z')
cout << x1 - 64 + y << endl;
else if (x >= 'a'&&x <= 'z')
cout << -(x1 - 96) + y << endl;
}
}
思路:借用ASCII码,将大写字符转化成整数再减去64,用于计算,(小写字母同理)。