首页 > 其他 > 详细

九度OJ 1093 WERTYU

时间:2015-01-01 07:53:00      阅读:182      评论:0      收藏:0      [点我收藏+]

题目1093:WERTYU

时间限制:1 秒

内存限制:32 兆

特殊判题:

提交:1375

解决:525

题目描述:

    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 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.

样例输入:
O S, GOMR YPFSU/
样例输出:
I AM FINE TODAY.

#include<stdio.h>
#include<string.h>
char s1[]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
char a[128];
char s2[1000];
void Init()
{
    for(int i=1;i<sizeof(s1)/sizeof(char);i++)
        a[s1[i]]=s1[i-1];
    a[' ']=' ';
}
int main()
{
    Init();
    int i;
    while(gets(s2))
    {
        for(i=0;i<strlen(s2);i++)
        {
            printf("%c",a[s2[i]]);
        }
        printf("\n");
    }
    return 0;
}
 
/**************************************************************
    Problem: 1093
    User: kirchhoff
    Language: C
    Result: Accepted
    Time:0 ms
    Memory:916 kb
****************************************************************/




九度OJ 1093 WERTYU

原文:http://blog.csdn.net/wdkirchhoff/article/details/42300995

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!