An easy problem
#include<stdio.h> #include<string.h> #include<stdlib.h> int fun(char c,int x) { int f[26]; int i; for(i=0;i<26;i++) f[i]=i+1; if(c>='A'&&c<='Z') return f[c-'A']+x; else return -f[c-'a']+x; } int main( ) { int N,y; char ch[10]; scanf("%d",&N); getchar(); while(N--) { scanf("%s%d",ch,&y); //printf("y:%d\n"); printf("%d\n",fun(ch[0],y)); } return 0; }
posted on 2011-05-02 14:17 more think, more gains 阅读(159) 评论(0) 编辑 收藏 举报