zoukankan      html  css  js  c++  java
  • SDNU 1382.Problem C: WERTYU(水题)

    Description

    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

    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. 

    Output

    You are to replace each letter or punctuation 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/
    

    Sample Output

    I AM FINE TODAY.
    

    Source

    #include <cstdio>
    #include <iostream>
    #include <cmath>
    #include <string>
    #include <cstring>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <map>
    using namespace std;
    #define ll long long
    const int inf = 0x3f3f3f3f;
    const int mod = 1e9+7;
    
    string s;
    
    int main()
    {
        while(getline(cin, s))
        {
            int len = s.size();
            for(int i = 0; i<len; i++)
            {
                if(s[i] == '1')printf("`");
                else if(s[i] == '2')printf("1");
                else if(s[i] == '3')printf("2");
                else if(s[i] == '4')printf("3");
                else if(s[i] == '5')printf("4");
                else if(s[i] == '6')printf("5");
                else if(s[i] == '7')printf("6");
                else if(s[i] == '8')printf("7");
                else if(s[i] == '9')printf("8");
                else if(s[i] == '0')printf("9");
                else if(s[i] == '-')printf("0");
                else if(s[i] == '=')printf("-");
                else if(s[i] == 'W')printf("Q");
                else if(s[i] == 'E')printf("W");
                else if(s[i] == 'R')printf("E");
                else if(s[i] == 'T')printf("R");
                else if(s[i] == 'Y')printf("T");
                else if(s[i] == 'U')printf("Y");
                else if(s[i] == 'I')printf("U");
                else if(s[i] == 'O')printf("I");
                else if(s[i] == 'P')printf("O");
                else if(s[i] == '[')printf("P");
                else if(s[i] == ']')printf("[");
                else if(s[i] == 92)printf("]");///
                else if(s[i] == 'S')printf("A");
                else if(s[i] == 'D')printf("S");
                else if(s[i] == 'F')printf("D");
                else if(s[i] == 'G')printf("F");
                else if(s[i] == 'H')printf("G");
                else if(s[i] == 'J')printf("H");
                else if(s[i] == 'K')printf("J");
                else if(s[i] == 'L')printf("K");
                else if(s[i] == ';')printf("L");
                else if(s[i] == 39)printf(";");
                else if(s[i] == 'X')printf("Z");
                else if(s[i] == 'C')printf("X");
                else if(s[i] == 'V')printf("C");
                else if(s[i] == 'B')printf("V");
                else if(s[i] == 'N')printf("B");
                else if(s[i] == 'M')printf("N");
                else if(s[i] == ',')printf("M");
                else if(s[i] == '.')printf(",");
                else if(s[i] == '/')printf(".");
                else if(s[i] == ' ')printf(" ");
            }
            printf("
    ");
        }
        return 0;
    }
  • 相关阅读:
    python基础 列表推导式
    信息时代的个人知识管理探微
    quaternion 四元数
    Display Lists在内存中的形式
    有关四元数 我所理解的四元数
    ogre scene_blend 透明
    ogre RenderTexture alpha rtt透明续
    四元数
    Ogre overlay实现帧动画
    贴图消失
  • 原文地址:https://www.cnblogs.com/RootVount/p/11256299.html
Copyright © 2011-2022 走看看