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;
    }
  • 相关阅读:
    5_4 编码重新总结
    5_9 ___2 mc函数
    5_9 代码分析 load_pic_pointers
    5_2 实现过程中
    5_4 calvc
    428 对于 mb_cmp_init函数中一些宏定义的展开 x264_encoder_open中
    Oracle数值处理函数
    JAVA常用注解
    Java随笔
    centos 7 上Hive2.1.1的安装与基本操作
  • 原文地址:https://www.cnblogs.com/TheLaughingMan/p/2919856.html
Copyright © 2011-2022 走看看