您的位置:首页 > 其它

n a^o7 !(山东省第三届ACM大学生程序设计竞赛 )

2017-05-23 20:09 471 查看

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)

Example Input

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


Example Output

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


 题意:解密;

ps:很简单,比赛的时候心态很重要;

Java:

import java.util.*;

public class Main {
public static char fun(char c){
switch (c){
case 'n':return 'u';
case '5':return 's';
case '!':return 'i';
case 'w':return 'm';
case 'p':return 'd';
case 'u':return 'n';
case 'e':return 'a';
case 'a':return 'e';
case '^':return 'v';
case 'o':return 'o';
case '7':return 'l';
case ' ':return ' ';
default: return '0';
}
}

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
char a[]=new char[110];
int l = 0;
int T=input.nextInt();
String aa=input.nextLine();
for(int t=1;t<=T;t++){
String s=input.nextLine();
l=s.length();
for(int i=l-1;i>=0;i--){
a[l-i-1]=fun(s.charAt(i));
}
System.out.print("Case "+t+": ");
for(int i=0;i<l;i++){
System.out.print(a[i]);
}
System.out.println();
}

}

}


C++
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <stack>
#define LL long long
#define INF 0x7fffffff
#define MAX 200010
#define PI 3.1415926535897932
#define E 2.718281828459045
using namespace std;
string s;
int T;
char fun(char c)
{
switch (c)
{
case 'n':
return 'u';
case '5':
return 's';
case '!':
return 'i';
case 'w':
return 'm';
case 'p':
return 'd';
case 'u':
return 'n';
case 'e':
return 'a';
case 'a':
return 'e';
case '^':
return 'v';
case 'o':
return 'o';
case '7':
return 'l';
case ' ':
return ' ';
default:
return '0';
}
}
int main()
{
scanf("%d",&T);
getchar();  //吞回车;
int t=1;
while(T--){
getline(cin,s);  //读取一行;
int len=s.length();
printf("Case %d: ",t++);
for(int i=len-1;i>=0;i--) printf("%c",fun(s[i]));
printf("\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  acm 模拟
相关文章推荐