已AC代码:
#include<cstdio>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
char x;
int y;
getchar();
scanf("%c%d", &x, &y);
if(x>64 && x<91)
printf("%d\n", x-64+y);
if(x>96 && x<123)
printf("%d\n", -(x-96)+y);
}
return 0;
}