Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 16297 Accepted Submission (s): 10937
Problem descriptionwe define f (a) = 1, f (a) =-1, f (b) = 2, f (b) =-2, ... f (z) = n, f (z) =-26;
Give you a letter x and a number y, you should output the result of y+f (x).
Inputon The first line, contains a number t.then T lines follow, each line was a Case.each case contains a letter and a num ber.
Outputfor the should the result of y+f (x) on a line.
Sample Input
6R 1P 2G 3r 1p 2g 3
Sample Output
191810-17-14-4
#include <stdio.h>
Main ()
{
char c;
int a,b,d,s,n,w,i,q;
scanf ("%d", &q);
GetChar ();
while (n--)
for (i=0;i<q;i++)
{
scanf ("%c%d", &c,&s);
if (c>= ' A ' &&c<= ' Z ')
{a=c-' 0 '-16;
W=a+s;
printf ("%d\n", W);
}
Continue
if (c>= ' a ' &&c<= ' Z ')
{b=c-' 0 ';
b=b-48;
A=-b;
W=a+s;
printf ("%d\n", W);
Continue
}
printf ("%d\n", W);
GetChar ();
}
return 0;
}
As easy problem