zoukankan      html  css  js  c++  java
  • poj2608---几个字母映射到同一个数字

    #include <stdio.h>
    #include <stdlib.h>
    #include<string.h>
    int map[26]={0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2};
    int main()
    {
        char str[20];
        int i;
        while(scanf("%s",str) != EOF )
        {
            for(i=0; i < strlen(str); i++)
            {
                if(str[i] == 'A' ||str[i] == 'E'||str[i] == 'I'||str[i] == 'O'||str[i] == 'U'||str[i] == 'H'||str[i] == 'W'||str[i] == 'Y')
                    continue;
                else
                {
                    if(i == 0)
                        printf("%d",map[str[0] - 'A']);
                    else
                    {
                        if(map[ str[i] - 'A'] == map[ str[i-1] - 'A'])
                            continue;
                        else
                            printf("%d",map[str[i] - 'A']);
                    }
                }
            }//for
            printf("
    ");
        }
        return 0;
    }
    View Code
  • 相关阅读:
    dom操作
    今天学到的知识点
    3.26随笔
    dom操作
    Ajax
    JSP、EL、JSTL
    Cookie和Session
    HttpServletResponse
    Servlet
    tomcat
  • 原文地址:https://www.cnblogs.com/gabygoole/p/4582987.html
Copyright © 2011-2022 走看看