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;
    }
  • 相关阅读:
    ORM模型框架(使用mysql)
    Python操作Mysql
    Jmeter操作数据库
    .NetCore+OpenSSL实现Https
    深入理解Https如何保证通信安全
    关于数据库事务和锁的一些分析
    C# Task.Run与Task.Factory.StartNew
    WPF 元素代理解决MVVM模式下DataGridColumn绑定无效问题
    WPF DataGrid行拖拽
    C#集合Clear()和new的性能差异
  • 原文地址:https://www.cnblogs.com/TheLaughingMan/p/2919856.html
Copyright © 2011-2022 走看看