#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int fun(char c,int x)
{
int f[26];
int i;
for(i=0;i<26;i++)
f[i]=i+1;
if(c>='A'&&c<='Z')
return f[c-'A']+x;
else
return -f[c-'a']+x;
}
int main( )
{
int N,y;
char ch[10];
scanf("%d",&N);
getchar();
while(N--)
{
scanf("%s%d",ch,&y);
//printf("y:%d\n");
printf("%d\n",fun(ch[0],y));
}
return 0;
}
转载于:https://www.cnblogs.com/tangcong/archive/2011/05/02/2034357.html