Michael Scofield's letter 2140 (字符串)
2015-08-21 19:41
302 查看
Michael Scofield's letter
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3585 Accepted Submission(s): 2073
[align=left]Problem Description[/align]
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?
[align=left]Input[/align]
The input will consist of several cases, one per line.
Each case is a letter from Michael, the letteres won't exceed 10000.
[align=left]Output[/align]
For each case, output the encode letter one line.
[align=left]Sample Input[/align]
pmicsibforgevibliqbscrct
ebmovibyout
[align=left]Sample Output[/align]
please forgive me, sara!
i love you!
#include<stdio.h> #include<string.h> char a[10100]; int main(){ int i,l; while(gets(a)!=NULL) { l=strlen(a); for(i=0;i<l;i++) { if(a[i]=='b')a[i]=' '; else if(a[i]=='q')a[i]=','; else if(a[i]=='t')a[i]='!'; else if(a[i]=='m')a[i]='l'; else if(a[i]=='i')a[i]='e'; else if(a[i]=='c')a[i]='a'; else if(a[i]=='a')a[i]='c'; else if(a[i]=='e')a[i]='i'; else if(a[i]=='l')a[i]='m'; } for(i=0;i<l;i++) printf("%c",a[i]); printf("\n"); } return 0; }
相关文章推荐
- C语言 - 结构体
- 对开源C++网络库简单应用总结
- POJ_2559_Largest Rectangle in a Histogram(栈)
- 算法、技术及其他
- UFLDL教程(四)---深度网络
- ACM大一练习赛-第三场——A - 海森堡不确定原理
- Java和C++的区别
- zoj 2507 Let's play a game
- AngularJs 构建复杂应用(一)
- [IOS]CoreAnimation基础[翻译4部分]
- js流程控制语句(switch语句)
- Java相关书籍推荐
- 几款国产开源的Windows界面库
- Apache Spark 入门简介
- git图解:代码区域总结
- 数据库 mysql 优化器原理
- eclipse导出可执行的jar包
- 友谊赛 排序 水题
- Linux系统负载
- 最大流:Dinic模板