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;
    }
  • 相关阅读:
    MM and Desinger
    db subsequent and synchronization(transfer)
    Thread concepts
    Threads concepts
    lucene article
    primary key
    lucene
    page procedure
    connection pool
    page procedures
  • 原文地址:https://www.cnblogs.com/TheLaughingMan/p/2919856.html
Copyright © 2011-2022 走看看