sdut 2413: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)

示例输入

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大学生程序设计竞赛


  水题

  因为只会出现“n5!wpuea^o7!”这些字符,所以依次单独处理即可。

  代码:


 1 #include <iostream>
2 #include <stdio.h>
3 #include <string.h>
4 using namespace std;
5 void work(char a[])
6 {
7 int i;
8 for(i=0;a[i];i++){
9 switch(a[i]){
10 case ‘n‘:a[i]=‘u‘;break;
11 case ‘5‘:a[i]=‘s‘;break;
12 case ‘w‘:a[i]=‘m‘;break;
13 case ‘p‘:a[i]=‘d‘;break;
14 case ‘u‘:a[i]=‘n‘;break;
15 case ‘e‘:a[i]=‘a‘;break;
16 case ‘a‘:a[i]=‘e‘;break;
17 case ‘^‘:a[i]=‘v‘;break;
18 case ‘o‘:a[i]=‘o‘;break;
19 case ‘7‘:a[i]=‘l‘;break;
20 case ‘!‘:a[i]=‘i‘;break;
21 default:break;
22 }
23 }
24 }
25 int main()
26 {
27 int n,cnt = 1;
28 cin>>n;
29 getchar();
30 while(n--){
31 char a[110];
32 cin.getline(a,120,‘\n‘);
33 work(a);
34 cout<<"Case "<<cnt++<<": ";
35 int len = strlen(a)-1;
36 for(;len>=0;len--)
37 cout<<a[len];
38 cout<<endl;
39 }
40 return 0;
41 }
42
43
44 /**************************************
45 Problem id : SDUT OJ D
46 User name : Miracle
47 Result : Accepted
48 Take Memory : 472K
49 Take Time : 0MS
50 Submit Time : 2014-04-27 09:16:04
51 **************************************/

Freecode : www.cnblogs.com/yym2013

sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理),码迷,mamicode.com

时间: 2024-12-25 22:30:20

sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)的相关文章

sdut 2411:Pixel density(第三届山东省省赛原题,字符串处理)

Pixel density Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 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 s

sdut 2416:Fruit Ninja II(第三届山东省省赛原题,数学题)

Fruit Ninja II Time Limit: 5000MS Memory limit: 65536K 题目描述 Have you ever played a popular game named "Fruit Ninja"?Fruit Ninja (known as Fruit Ninja HD on the iPad and Fruit Ninja THD for Nvidia Tegra 2 based Android devices) is a video game de

sdut 2610:Boring Counting(第四届山东省省赛原题,划分树 + 二分)

Boring Counting Time Limit: 3000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 In this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence. Now you task is to answer a list of queries, for each quer

sdut 2603:Rescue The Princess(第四届山东省省赛原题,计算几何,向量旋转 + 向量交点)

Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia

Sdut 2416 Fruit Ninja II(山东省第三届ACM省赛 J 题)(解析几何)

Time Limit: 5000MS Memory limit: 65536K 题目描写叙述 Haveyou ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja HD on the iPad and Fruit Ninja THD for NvidiaTegra 2 based Android devices) is a video game developed by Hal

Sdut2411 Pixel density 山东省第三届ACM省赛(输入输出字符串处理)

本文出处:http://blog.csdn.net/svitter 原题:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2411 题意:给你一个串,让你依据那个串来输出ppi.坑特别多.ppi的计算方法是dp / inches; dp = sqrt(wp*wp + hp * hp); 现在我来说说这个题目有多坑: 给你的串的格式是这样: name + inches+ "inches"

Sdut 2108 Alice and Bob(数学题)(山东省ACM第四届省赛D题)

题目地址:sdut 2608 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)*....

Sdut 2165 Crack Mathmen(数论)(山东省ACM第二届省赛E 题)

Crack Mathmen TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 Since mathmen take security very seriously, theycommunicate in encrypted messages. They cipher their texts in this way: for everycharacther c in the message, they replace c wit

sdut 2841 Bit Problem (水题)

题目 贴这个题是因为看题解有更简单的方法, 我做的时候是直接算的, 也很简单. 贴一下题解吧: 如果一个整数不等于 0,那么该整数的二进制表示中至少有一位是 1. 这个题结果可以直接输出 x - (x&(x-1)); 因为x-1 之后二进制下,就是最右边的1变成了0, 最右边的1的 右边所有的0变成了1, 不影响最左边. 我的代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4