2012年"浪潮杯"山东省第三届ACM大学生程序设计竞赛--n a^o7 ! 分类: ...

本文通过简单的字符串替换和反转操作,解析了一段看似无意义的字符背后隐藏的浪漫情书内容。介绍了如何使用C++实现这一过程,并提供了一个示例程序。

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)

示例输入

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
一道水题,模拟
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <cmath>
#include <string.h>
#include <string>
#include <algorithm>
#define  INF 0x3f3f3f3f
#define ClearAll(A,T) memset(A,T,sizeof(a))
using namespace std;
const int Max=110;
char str[Max];
int main()
{
    int T,w=1;
    scanf("%d",&T);
    getchar();
    while(T--)
    {
        gets(str);
        int len=strlen(str);
        for(int i=0; i<len; i++)
        {
            switch(str[i])
            {
            case 'n':
                str[i]='u';
                break;
            case 's':
                str[i]='5' ;
                break;
            case '5':
                str[i]='s';
                break;
            case '!':
                str[i]='i';
                break;
            case 'i':
                str[i]='!' ;
                break;
            case 'w':
                str[i]='m';
                break;
            case 'm':
                str[i]='w' ;
                break;
            case 'p':
                str[i]='d';
                break;
            case 'd':
                str[i]='p' ;
                break;
            case 'u':
                str[i]='n';
                break;
            case 'a':
                str[i]='e' ;
                break;
            case 'e':
                str[i]='a' ;
                break;
            case '7':
                str[i]='l' ;
                break;
            case 'l':
                str[i]='7' ;
                break;
            case '^':
                str[i]='v' ;
                break;
            case 'v':
                str[i]='^' ;
                break;
            default :
                break;
            }
        }
        printf("Case %d: ",w++);
        for(int i=len-1;i>=0;i--)
        {
            printf("%c",str[i]);
        }
        printf("\n");
    }
    return 0;
}




版权声明:本文为博主原创文章,未经博主允许不得转载。

转载于:https://www.cnblogs.com/juechen/p/4722049.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值