zoukankan      html  css  js  c++  java
  • [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;
    }
    


     

  • 相关阅读:
    使用layer.tips实现鼠标悬浮时触发事件提示消息实现
    鼠标移入、移出触发事件实现
    vue组件独享守卫钩子函数参数详解(beforeRouteEnter、beforeRouteUpdate、beforeRouteLeave)
    vscode 向下复制当前行(即visual studio 中的Ctrl + D)功能快捷键
    vue UI可视化窗口修改为显示中文
    js中的匿名函数
    NPM install -save 和 -save-dev 傻傻分不清
    Node.js中package.json中库的版本号详解(^和~区别)
    RTX管理器里怎么建群
    Mysql的timestamp(时间戳)详解以及2038问题的解决方案
  • 原文地址:https://www.cnblogs.com/sr1993/p/3697748.html
Copyright © 2011-2022 走看看