zoukankan      html  css  js  c++  java
  • [解题报告]10082 WERTYU

    Problem C: WERTYU

    A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.

    Input consists of several lines of text. Each line may contain digits, spaces, upper case letters (except Q, A, Z), or punctuation shown above [except back-quote (`)]. Keys labelled with words [Tab, BackSp, Control,etc.] are not represented in the input. You are to replace each letter or punction symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.

    Sample Input

    O S, GOMR YPFSU/
    

    Output for Sample Input

    I AM FINE TODAY.


    题目简单,不过一个个输进去太蛋疼了!
    #include<stdio.h>
    #include<string.h>
    
    char keyboard[]={'`','1','2','3','4','5','6','7','8','9','0','-','=','Q','W','E','R','T','Y','U',
    'I','O','P','[',']','\\','A','S','D','F','G','H','J','K','L',';','\'','Z','X','C','V','B','N','M',',','.','/'};
    
    int main()
    {
        char string[1000];
        int i,j;
        while(gets(string))
        {
            for(i = 0;i < strlen(string);i++){
                if(string[i] == ' '){
                    printf(" ");
                }
                else{
                    for(j = 0;j < strlen(keyboard);j++){
                        if(string[i] == keyboard[j]){
                            printf("%c",keyboard[j-1]);
                            break;
                        }
                    }
                }
            }
            printf("\n");
        }
        return 0;
    }
  • 相关阅读:
    如何规范自己的编程以及软件开发目录(二)
    关于README的内容
    关于编程编程规范以及开发目录的规范性
    第五章:条件、循环以及其他语句(上)
    第四章 当索引行不通时
    python-zipfile模块
    python-shutil模块
    python-sys模块
    python-os模块
    python-threading.Thread(多线程)
  • 原文地址:https://www.cnblogs.com/TheLaughingMan/p/2919856.html
Copyright © 2011-2022 走看看