• Codeforce 474A


    Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:


    qwertyuiop
    asdfghjkl;
    zxcvbnm,./

    Unfortunately Mole is blind, so sometimes it is problem for him to put his hands accurately. He accidentally moved both his hands with one position to the left or to the right. That means that now he presses not a button he wants, but one neighboring button (left or right, as specified in input).

    We have a sequence of characters he has typed and we want to find the original message.

    Input

    First line of the input contains one letter describing direction of shifting ('L' or 'R' respectively for left or right).

    Second line contains a sequence of characters written by Mole. The size of this sequence will be no more than 100. Sequence contains only symbols that appear on Mole's keyboard. It doesn't contain spaces as there is no space on Mole's keyboard.

    It is guaranteed that even though Mole hands are moved, he is still pressing buttons on keyboard and not hitting outside it.

    Output

    Print a line that contains the original message.

    Examples
    input
    R
    s;;upimrrfod;pbr
    output
    allyouneedislove

     题解:直接模拟

     1 #include <iostream>
     2 #include <algorithm>
     3 #include <cstring>
     4 #include <cstdio>
     5 #include <vector>
     6 #include <cstdlib>
     7 #include <iomanip>
     8 #include <cmath>
     9 #include <ctime>
    10 #include <map>
    11 #include <set>
    12 using namespace std;
    13 #define lowbit(x) (x&(-x))
    14 #define max(x,y) (x>y?x:y)
    15 #define min(x,y) (x<y?x:y)
    16 #define MAX 100000000000000000
    17 #define MOD 1000000007
    18 #define pi acos(-1.0)
    19 #define ei exp(1)
    20 #define PI 3.141592653589793238462
    21 #define INF 0x3f3f3f3f3f
    22 #define mem(a) (memset(a,0,sizeof(a)))
    23 typedef long long ll;
    24 const int N=205;
    25 const int mod=1e9+7;
    26 int a[12];
    27 int main()
    28 {
    29     string a="qwertyuiopasdfghjkl;zxcvbnm,./";
    30     char b,c[100];
    31     scanf("%c%s",&b,c);
    32     for(int j=0;j<strlen(c);j++)
    33     for(int i=0;i<a.size();i++){
    34         if(a[i]==c[j]){
    35              if(b=='L')
    36                 printf("%c",a[i+1]);
    37              else
    38                 printf("%c",a[i-1]);
    39              break;
    40          }
    41      }
    42     return 0;
    43 }
  • 相关阅读:
    【Nginx】跨域配置
    【Python】【Chart】图标绘制/地图生成
    【Python】操作压缩文件
    【VSCode】koroFileHeader插件自动添加文件及函数注释
    【性能】web页面性能之lighthouse使用
    【VSCode】格式化后换行
    【Python】MD5
    【IDEA】自定义/自动生成/注释/新增文件自动生成注释/自动生成方法注释
    【Java】文件下载/下载Excel/下载文件到本地
    【杂项】英语学习
  • 原文地址:https://www.cnblogs.com/wydxry/p/7259597.html
Copyright © 2020-2023  润新知