天天看點

HDU1048 - The Hardest Problem Ever (簡單題)思路代碼

題目連結

  • 思路
  • 代碼

思路

一道簡單的入門題,列出表,然後輸入輸出就行。不過最開始智商被壓制了,漏掉了字母 D <script type="math/tex" id="MathJax-Element-1">D</script>, WA 到哭。

代碼

#include <cstring>
#include <cstdio>

using namespace std;

int main()
{
    char table[];
    char text[];
    table[] = '\n';
    for(int i=; 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-;

    while(true)
    {
        gets(text);
        if(strcmp(text, "ENDOFINPUT")==) break;
        else if(strcmp(text, "END")==) ;
        else if(strcmp(text, "START")==) ;
        else
        {
            int len = strlen(text);
            for(int i=; i<=len; i++) printf("%c", table[text[i]]);
        }
    }
    return ;
}