An easy problem

#include <cstdio>
#include <iostream>
using namespace std;

int f[30], F[30];

int main()
{
	char c;
	int n, m, p;
	cin >> n;
	
	for(int i = 1; i <= 26; ++ i)	f[i] = -i;
	for(int i = 1; i <= 26; ++ i)	F[i] = i;
	
	while(n --)
	{
		cin >> c >> m;
		
		if(c >= 'a' && c <= 'z')	p = f[c - 'a' + 1];
		else if(c >= 'A' && c <= 'Z')	p = F[c - 'A' + 1];
		
		printf("%d\n", m + p);
	}
	
	return 0;
} 

  

posted @ 2019-08-04 17:27  青衫客36  阅读(155)  评论(0编辑  收藏  举报