hdoj:2055

时间:2021-02-25 19:51:21
#include <iostream>
#include <string> using namespace std; bool islower(char ch)
{
if (ch >= 'a' && ch <= 'z')
return true;
return false;
} bool isUpper(char ch)
{
if (ch >= 'A' && ch <= 'Z')
return true;
return false;
}
int main()
{
int T;
char ch;
int y, sum = ;
cin >> T;
while (T--)
{ cin >> ch >> y;
sum = y;
if (islower(ch))
{
sum = sum - ( ch - 'a'+ );
}
else
{
sum = sum + (ch - 'A' + );
}
cout << sum << endl; }
return ;
}