hdoj 2140 Michael Scofield's letter
来源:互联网 发布:懒猫营销软件 编辑:程序博客网 时间:2024/06/06 20:26
Michael Scofield's letter
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3586 Accepted Submission(s): 2074
Problem Description
I believe many people are the fans of prison break. How clever Michael is!! In order that the message won't be found by FBI easily, he usually send code letters to Sara by a paper crane. Hence, the paper crane is Michael in the heart of Sara. Now can you write a program to help Sara encode the letter from Michael easily?
The letter from Michael every time is a string of lowercase letters. You should encode letters as the rules below:
b is ' ', q is ',', t is '!', m is l, i is e, c is a, a is c, e is i, l is m. It is interesting. Are you found that it is just change michael to leahcim?
The letter from Michael every time is a string of lowercase letters. You should encode letters as the rules below:
b is ' ', q is ',', t is '!', m is l, i is e, c is a, a is c, e is i, l is m. It is interesting. Are you found that it is just change michael to leahcim?
Input
The input will consist of several cases, one per line.
Each case is a letter from Michael, the letteres won't exceed 10000.
Each case is a letter from Michael, the letteres won't exceed 10000.
Output
For each case, output the encode letter one line.
Sample Input
pmicsibforgevibliqbscrctebmovibyout
Sample Output
please forgive me, sara!i love you!
题意:输入一个可带空格的字符串;在此字符串中,
把b换成 ' '(空格),
q 换成 ','(逗号),
把 t 换成 '!'(感叹号),
把 m 换成 l(小写字母L),
把 i 换成 e,
把 c 换成 a,
a 换成 c,
把 e 换成 i
,把 l (小写字母L)换成 m.
思路:建两个数组,把相应的变换的字符放在两个数组的对应位置,然后对输入的字符逐个比较;
#include<stdio.h>char str1[]={'b','q','t','l','m','e','i','c','a'};char str2[]={' ',',','!','m','l','i','e','a','c'};int main(){int c,i;while((c=getchar())!=EOF){for(i=0;str1[i]&&str1[i]!=c;i++);if(str1[i]) putchar(str2[i]);else putchar(c);}return 0;}
如有其它意见或建议,欢迎品论
亦可联系博主qq:1328705994
0 0
- hdoj 2140 Michael Scofield's letter
- HDOJ/HDU 2140 Michael Scofield's letter(字符转换~)
- Michael Scofield's letter
- HDU 2140 Michael Scofield's letter
- HDU-2140 Michael Scofield's letter 水题
- Michael Scofield's letter 2140 (字符串)
- HDU#2140: Michael Scofield's letter
- HDOJ2140 Michael Scofield's letter
- HDU—— 2140 Michael Scofield's letter
- Luc Berson's letter
- 英语练习78 Michael's Dream
- Michael Nielsen 's 神经网络学习之一
- Jackson Michael's history:past,present and future
- 2000行代码 出自Michael Chen's Blog
- Michael Kors Handtassen a fself-help guide toshionistshopping online's
- 浙大ACM 3455 Shizuka's Letter
- 814 - The Letter Carrier's Rounds
- 814 - The Letter Carrier's Rounds
- hdu 4372 Count the Buildings
- 深入理解JavaScript系列(11):执行上下文(Execution Contexts)
- tabbar下方的红色提示图标
- sqlServer 读取dbf文件
- UVA 1149
- hdoj 2140 Michael Scofield's letter
- 深入理解JavaScript系列(12):变量对象(Variable Object)
- Intent的各种属性问题以及IntentFilter配置问题
- KMP算法详解
- 第一个出现的不相同的字符
- this.Invoke参数计数不匹配
- 41.AFN的使用和收藏工具
- 如何定位Release 版本中程序崩溃的位置 ---利用map文件 拦截windows崩溃函数
- 深入理解JavaScript系列(13):This? Yes,this!