杭电2055AneasyproblemProblemDescriptionwedefinef(A)=1,f(a)=-1,f(B)=2,f(b)=-2,...f(Z)=26,f(z)=-26;Giveyoualetterxandanumbery,youshouldoutputtheresultofy+f(x).InputOnthefirstline,containsanumberT.thenTlinesf
杭电2055Aneasyproblem
ProblemDescription
wedefinef(A)=1,f(a)=-1,f(B)=2,f(b)=-2,...f(Z)=26,f(z)=-26;
Giveyoualetterxandanumbery,youshouldoutputtheresultofy+f(x).
Input
Onthefirstline,containsanumberT.thenTlinesfollow,eachlineisacase.eachcasecontainsaletterandanumber.
Output
foreachcase,youshouldtheresultofy+f(x)onaline.
SampleInput
6
R1
P2
G3
r1
p2
g3
SampleOutput
19
18
10
-17
-14
-4
我的代码:这段一直过不了,检查不出错,无奈之下switch了一大串,终于通过了,不过还想求教这段到底哪里有问题,
#include
intmain()
{
x05inta,s,i;
x05charz;
while(scanf("%d",&a)!=EOF)
{
x05for(i=0;i='a'&&z='A'&&z