HDU1048 - The Hardest Problem Ever (简单题)

来源:互联网 发布:刷空间访问量软件 编辑:程序博客网 时间:2024/05/02 02:35

题目链接

  • 思路
  • 代码

思路

一道简单的入门题,列出表,然后输入输出就行。不过最开始智商被压制了,漏掉了字母 D, WA 到哭。

代码

#include <cstring>#include <cstdio>using namespace std;int main(){    char table[250];    char text[1000];    table[0] = '\n';    for(int i=1; i<'A'; i++) table[i] = i;    table['A'] = 'V';    table['B'] = 'W';    table['C'] = 'X';    table['D'] = 'Y';    table['E'] = 'Z';    for(int i='F'; i<='Z'; i++) table[i] = i-5;    while(true)    {        gets(text);        if(strcmp(text, "ENDOFINPUT")==0) break;        else if(strcmp(text, "END")==0) ;        else if(strcmp(text, "START")==0) ;        else        {            int len = strlen(text);            for(int i=0; i<=len; i++) printf("%c", table[text[i]]);        }    }    return 0;}
0 0
原创粉丝点击