SDUT 2413 n a^o7 !

本文介绍了一道简单的编程题目,任务是将特定格式的字符串进行逆序输出。通过一个具体的示例,展示了如何使用C语言来实现这一功能,并提供了一个简洁明了的代码示例。

 

n a^o7 !

Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description

 

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

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

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

 

Sample Input
2
n 55!w ! pue n a^o7 ! n paau !
n5!wpuea^o7
Sample Output
Case 1: i need u i love u and i miss u
Case 2: loveandmisu

提示:这个题乍一看,看不懂,其实就是个水题,但是这个水题还挺有意思,就是照着输入把输出倒过来就可以。

代码实现如下(gcc):
#include<stdio.h>
#include<string.h>
int main()
{
    int n;
    scanf("%d",&n);
    for(int j=1; j<=n; j++)
    {
        char s[110];
        if(j==1)
            getchar();
        gets(s);
        printf("Case %d: ",j);
        for(int i=strlen(s)-1; i>=0; i--)
        {
            if(s[i]=='n')
                printf("u");
            if(s[i]=='5')
                printf("s");
            if(s[i]=='!')
                printf("i");
            if(s[i]=='w')
                printf("m");
            if(s[i]=='p')
                printf("d");
            if(s[i]=='u')
                printf("n");
            if(s[i]=='e')
                printf("a");
            if(s[i]=='a')
                printf("e");
            if(s[i]=='^')
                printf("v");
            if(s[i]=='o')
                printf("o");
            if(s[i]=='7')
                printf("l");
            if(s[i]==' ')
                printf(" ");
        }
        printf("\n");
    }
    return 0;
}


/***************************************************
Result: Accepted
Take time: 0ms
Take Memory: 144KB
****************************************************/

 

转载于:https://www.cnblogs.com/jkxsz2333/p/9506688.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值