[2012山东ACM省赛] n a^o7 !(模拟,字符替换)

n a^o7 !

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)

示例输入

2n 55!w ! pue n a^o7 ! n paau !n5!wpuea^o7

示例输出

Case 1: i need u i love u and i miss uCase 2: loveandmisu

提示

来源

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

解题思路:

字符替换,倒叙输出。

代码:

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    string s;
    int n;cin>>n;
    getchar();
    for(int ni=1;ni<=n;ni++)
    {
        getline(cin,s);
        for(int i=s.length()-1;i>=0;i--)
        {
            if(s[i]==‘!‘)
                s[i]=‘i‘;
            else if(s[i]==‘7‘)
                s[i]=‘l‘;
            else if(s[i]==‘^‘)
                s[i]=‘v‘;
            else if(s[i]==‘a‘)
                s[i]=‘e‘;
            else if(s[i]==‘e‘)
                s[i]=‘a‘;
            else if(s[i]==‘u‘)
                s[i]=‘n‘;
            else if(s[i]==‘p‘)
                s[i]=‘d‘;
            else if(s[i]==‘w‘)
                s[i]=‘m‘;
            else if(s[i]==‘5‘)
                s[i]=‘s‘;
            else if(s[i]==‘n‘)
                s[i]=‘u‘;
        }
        cout<<"Case "<<ni<<": ";
        for(int i=s.length()-1;i>=0;i--)
            cout<<s[i];
        cout<<endl;
    }
    return 0;
}

[2012山东ACM省赛] n a^o7 !(模拟,字符替换),布布扣,bubuko.com

时间: 2024-10-15 13:37:30

[2012山东ACM省赛] n a^o7 !(模拟,字符替换)的相关文章

[2012山东ACM省赛] Pick apples (贪心,全然背包,枚举)

Pick apples Time Limit: 1000MS Memory limit: 165536K 题目描写叙述 Once ago, there is a mystery yard which only produces three kinds of apples. The number of each kind is infinite. A girl carrying a big bag comes into the yard. She is so surprised because s

[2012山东ACM省赛] Pick apples (贪心,完全背包,枚举)

Pick apples Time Limit: 1000MS Memory limit: 165536K 题目描述 Once ago, there is a mystery yard which only produces three kinds of apples. The number of each kind is infinite. A girl carrying a big bag comes into the yard. She is so surprised because she

[2012山东ACM省赛] Fruit Ninja II (三重积分,椭球体积)

大概去年夏天的时候,在<C和指针>里面一个练习题要求实现一个很简单的不包含打印浮点数功能的printf函数.但是很好奇,于是一直纠结下去,结果就是知道了printf的实现,自己也写了一个简单的.或许是夏天的原因吧,那时候暑假没回去,凌晨四点兴奋到不能睡觉.那时候刚开始写blog.没想整理一下,只是简单的把最重要的实现"工具"贴了一个blog在 http://blog.csdn.net/cinmyheart/article/details/9804189 那时候第一次看lin

[2013山东ACM省赛] Alice and Bob

Alice and Bob Time Limit: 1000MS Memory limit: 65536K 题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1). Then Alice ask

[2013山东ACM省赛] The number of steps (概率DP,数学期望)

The number of steps Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Mary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the second layer have two rooms,the third layer have three rooms -). Now she st

[2011山东ACM省赛] Binomial Coeffcients(求组合数)

Binomial Coeffcients nid=24#time" style="padding-bottom:0px; margin:0px; padding-left:0px; padding-right:0px; color:rgb(83,113,197); text-decoration:none; padding-top:0px"> Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 输入

[2013山东ACM]省赛 The number of steps (可能DP,数学期望)

The number of steps nid=24#time" style="padding-bottom:0px; margin:0px; padding-left:0px; padding-right:0px; color:rgb(83,113,197); text-decoration:none; padding-top:0px"> Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 Mary

第六届山东ACM省赛总结

省赛总结 省赛打完了,结果在意料之中,教主的判断还是很准的,我们的水平在银牌区中段,运气好可以进金牌区.感觉队伍打的还不错,感谢给力的队友,但感觉我个人还是打的有点乱. 开场我先简单整体的翻了一下习题册,依旧abc一人一题,我开b,李睿易a王成瑞c,b读读感觉是个模拟,尽管感觉不难,但是之前每逢模拟必卡题,就先跳过了,和王成瑞去看c,是个博弈,有点小自信,因为省赛前一段时间做过几道博弈,又看到有一队5min C题1Y,自信的推c了,第一次直接对3取余wa一发,李睿易看出a水,喊王成瑞去写a,我继

2012山东省ACM省赛-Pixel density

Pixel density 题目描述 Pixels per inch (PPI) or pixel density is a measurement of the resolution of devices in various contexts; typically computer displays, image scanners, and digital camera image sensors. Note, the unit is not square inches. Good qual