HDU 2140 Michael Scofield's letter

http://acm.hdu.edu.cn/showproblem.php?pid=2140

按题意翻译字符串

View Code
#include <stdio.h>

#include <string.h>

int main()

{

    char tab[10][2]={{'b',' '},{'q',','},{'t','!'},{'m','l'},{'i','e'},{'c','a'},{'a','c'},{'e','i'},{'l','m'}};

    char s[11000];

    int len,i,j;

    while(~scanf("%s",s))

    {

        len=strlen(s);

        for(i=0;i<len;i++)

        {

            for(j=0;j<9;j++)

                if(s[i]==tab[j][0])

                {

                    printf("%c",tab[j][1]);

                    break;

                }

            if(j==9)

                printf("%c",s[i]);

        }

        putchar('\n');

    }

    return 0;

}

 

你可能感兴趣的:(Field)