[2012山东省第三届ACM大学生程序设计竞赛]——n a^o7 !

n a^o7 !

题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2413

Time Limit: 1000MS Memory limit: 65536K

题目描述
All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my instructions, which can make you in the best state preparing to fight. Now please relax yourself and enjoy the good moment. Before you raise your sharp sword to the enemy who guards the battleground, please allow me to tell you a true and romantic story about a samurai like you.
Samurai hh fell in love with girl ss, who is charming and demure. He realized the truth that he must spend his remaining life with ss, and resolved to pursue the hard-won affection. One day hh wrote a letter to ss, when she opens the letter with excitement her mind was in tangle. She found herself completely not to figure out the meaning about the letter, which said that "n 55!w ! pue n a^o7 ! n paau !". ss also immersed herself in guessing the meaning of that letter for a long time because of her adore to hh. Finally she called hh to ask the meaning of the letter. On the other side of the phone, hh was too nervous to say. Gradually he calmed down himself and told ss to reverse the letter and read it. Then on both ends of the phone comes the voice at the same time "i need u i love u and i miss u".
ss wants to tell each of you however you are Brave And Skilled, you shouldn't forget to express your loyal love and romantic feelings to your prince or princess.
Now the horn sounds for battle,do it by the following input and output. I think each of you will get an "Accepted" in this battle with pleasant mood.

输入
Input contains an integer T in the first line, and then T lines follow .Each line contains a message (only contain 'n5!wpuea^o7!' and
' '(space)), the message's length is no more than 100.

输出
Output the case number and the message. (As shown in the sample output)

示例输入
2
n 55!w ! pue n a^o7 ! n paau !

n5!wpuea^o7


示例输出
Case 1: i need u i love u and i miss u
Case 2: loveandmisu

来源

2012年"浪潮杯"山东省第三届ACM大学生程序设计竞赛


今天,做第三届的省赛题目。

唉,又是不开心呐。。

我们小组分了几个模块,我负责的两个主要的就是 搜索和计算几何。

恩,前两次搜索少,这一次来搜索了,

但是,这个难度。。。⊙﹏⊙b汗。。。

浪费了好多时间也没做出来,让简单的题A的完了。


这道题就是倒过来看。。。

原图:


倒过来看:


那具体怎么实现呢?因为所输入的字符个数有限:only contain 'n5!wpuea^o7!' and 
' '(space)

这有这几个,打个表就可以了,是在不行用个switch也行。

对了,输出的时候别忘了是从后往前输出,

读入的时候要读入一整行(包括空格)。。


简单题,很快AC

#include <iostream>  
#include <stdio.h>  
#include <cstring>  
using namespace std;  
char arr[310];  
int main()  
{  
    char s[105];  
    int i,j,t;  
    arr[ int('n') ]='u';  
    arr[ int('5') ]='s';  
    arr[ int('!') ]='i';  
    arr[ int('w') ]='m';  
    arr[ int('p') ]='d';  
    arr[ int('e') ]='a';  
    arr[ int('a') ]='e';  
    arr[ int('^') ]='v';  
    arr[ int('o') ]='o';  
    arr[ int('7') ]='l';  
    arr[ int(' ') ]=' ';  
    arr[ int('u') ]='n';  
    cin>>t;  
    cin.getline(s,101,'\n');  
    for(j=1;j<=t;++j)  
    {  
        cin.getline(s,101,'\n');  
        cout<<"Case "<<j<<": ";  
        for(i=strlen(s)-1;i>=0;--i)  
            cout<<arr[ int(s[i]) ];  
        cout<<endl;  
    }  
    return 0;  
}  


你可能感兴趣的:(ACM,N,ao7,山东省赛)