[恢]hdu 2055

2011-12-15 02:03:44

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2055

题意:字母替换成数字,求和,简单~~

代码:

# include <stdio.h>
# include <math.h>


int main ()
{
int T, num ;
char ch ;
scanf ("%d%*c", &T) ;
while (T--)
{
scanf ("%c %d%*c", &ch, &num) ;
if (ch >= 'a' && ch <= 'z')
num -= (ch-'a'+1) ;
else
num += (ch-'A'+1) ;
printf ("%d\n", num) ;
}
return 0 ;
}



posted @ 2012-01-06 14:57  Seraph2012  阅读(301)  评论(0编辑  收藏  举报