B - Encoded Love-letter 字符串的处理
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
Each charactor are changed to a corresponding charactor. If the keyword is "Angel", the rule will be:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ANGELZYXWVUTSRQPOMKJIHFDCB
You may find that in the bottom line, charactors of the keyword come first. All other charactors will come in a reversed order.
Now given another keyword, work the letter out!
Can you write a program to translate the letter?
Input
Output
the letter and print it out. Please note that a upper-case charactor
will be decoded to a upper-case charactor, while a lower-case charactor
will be decoded to a lower-case charactor.
Sample Input
Fxlr jxaj eac W xlam cqim hqwgl
W xahl kqsl kplgwat zlltwry
Tlj sl atfack jxwru W eqr'j farra zqmylj cqi
W mlslsnlm aj jxl eac
Cqi aml atfack qr sc swre
Lhlrjxqiyx W vikj gar jxwru anqij cqi
Wz jxl eac wr jxl zijiml
Jxwk tqhl fwtt nlgqswry jmil
W'hl rlhlm gxaryl sc swre jxaj W fwtt tqhl cqi zqmlhlm
W eqr'j gaml xqf zqqt wj wk
W fwtt tlj sc emlas gqsl jmil
W fwtt jltt cqi kqsljxwry W farra tlj cqi urqf, W tlj cqi urqf
W tqhl cqi, tqhwry cqi, ak jxl sqikl tqhlk jxl mwgl
Lhlr lhlmc eac xak kjqms, W fwtt atfack nc cqim kwel
W swkk cqi, swkkwry cqi
W eqr'j gaml xqf xame wj wk
W vikj farj cqi jq nl xappc
Lhlmcjxwry, W eq wj zqm cqi
Sample Output
I have some special feeling
Let me always think I don't wanna forget you
I remember at the day
You are always on my mind
Eventhough I just can think about you
If the day in the future
This love will becoming true
I've never change my mind that I will love you forever
I don't care how fool it is
I will let my dream come true
I will tell you something I wanna let you know, I let you know
I love you, loving you, as the mouse loves the rice
Even every day has storm, I will always by your side
I miss you, missing you
I don't care how hard it is
I just want you to be happy
Everything, I do it for you
#include<cstdio>
#include<string.h>
using namespace std;
char f[]="1ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char f1[];
int ff[];
char str[];
char s[];
int main()
{
int i,j;
int len;
scanf("%s",str);
//puts(str);
getchar();
len=strlen(str);
memset(ff,,sizeof(ff));
memset(f1,,sizeof(f1));
for(i=; i<=len; i++)
{
f1[i]=str[i-];
ff[str[i-]-'A'+]=;
//printf("%d ",ff[str[i-1]-'A'+1]);
}
j=i;
for(i=; i>=; i--)
if(ff[i]==)
{
f1[j++]='A'-+i;
//printf("%c ",f1[j-1]);
}
//printf("%s",f1);
while(gets(s))
{
len=strlen(s);
for(i=;i<len;i++)
{
if(s[i]>='A'&&s[i]<='Z')
{
for(j=;j<=;j++)
if(s[i]==f1[j]) printf("%c",f[j]);
} else if(s[i]>='a'&&s[i]<='z')
{
for(j=;j<=;j++)
if(s[i]-'a'+'A'==f1[j]) printf("%c",f[j]-'A'+'a');
} //else if(s[i]==0) printf("\n");
else printf("%c",s[i]);
}
printf("\n");
} return ;
}
B - Encoded Love-letter 字符串的处理的更多相关文章
- Python基础->for循环、字符串以及元组
python流程控制>for循环.字符串以及元组 学习有关序列的思想.序列:一组有顺序的东西.所有的序列都是由元素组成的,序列中的元素位置是从0开始编号的,最后一个元素的位置是它长度减一. fo ...
- 《think in python》学习-8
字符串 字符串是一个序列,可以用方括号操作符来访问字符串中的单独字符 fruit = 'banana' letter = fruit[1] 方括号中的表达式称为下标 下标从0 开始 任何表达式,包括变 ...
- [Swift]LeetCode917. 仅仅反转字母 | Reverse Only Letters
Given a string S, return the "reversed" string where all characters that are not a letter ...
- php json_encode 返回false
今天用ajax请求不到数据,发现问题出现在最后一句 echo json_encode($data); var_dump(json_encode($data));输出false 使用json_last_ ...
- 12-4 NSString
原文:http://rypress.com/tutorials/objective-c/data-types/nsstring NSString 在本教程的内容可能我们已经看到过很多次了,NSStri ...
- Html5——File、FileReader、Blob、Fromdata对象
File File 接口提供有关文件的信息,并允许网页中的JavaScript访问其内容. File对象可以用来获取某个文件的信息,还可以用来读取这个文件的内容.通常情况下,File对象是来自用户在一 ...
- Spring Boot项目中使用 TrueLicense 生成和验证License(服务器许可)
一 简介 License,即版权许可证,一般用于收费软件给付费用户提供的访问许可证明.根据应用部署位置的不同,一般可以分为以下两种情况讨论: 应用部署在开发者自己的云服务器上.这种情况下用户通过账号登 ...
- 劳动节快乐!手写个核心价值观编码工具 - Python实现
前言 今天是五一劳动节,祝各位无产阶级劳动者节日快乐! 然后来整活分享一些有趣的东西~ 这个小工具是我大学时做着玩的,对于各位接班人来说,12个词的核心价值观这东西,大家都非常熟悉了,这工具可以实现将 ...
- HDU 1591 Encoded Love-letter(简单字符串)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...
随机推荐
- [问题2014S13] 解答
[问题2014S13] 解答 (1) 先证必要性:若 \(A=LU\) 是 非异阵 \(A\) 的 \(LU\) 分解,则 \(L\) 是主对角元全部等于 1 的下三角阵,\(U\) 是主对角元全部 ...
- ArcGIS10.2中文版破解教程
ArcGIS10.2中文版前些时间早就出炉了,下载了但是一直没有安装,听说了ArcGIS10.2云处理能力和影像处理能力都增强了!网上经常遇到一些朋友安装失败的问题,现在特此做一个教程!分享一下安装成 ...
- 初学画布canvas的chapter2
文本 1.字体属性 context.font = [css font property] ——使用CSS规范,语法跟CSS字体速记符号一致 ——line-height无效,并永远忽略 Context. ...
- 汇编中push寄存器的影响
由于汇编代码中的不同位置 ESP+40所指的地址不像EBP+40的地址那个是一定的,ESP+40指向的地址由栈顶变化影响.也就是和操作栈指令 PUSH POP 等影响. 汇编栈是一个线性的地址区间,地 ...
- [bzoj3555]企鹅QQ(hash)
3555: [Ctsc2014]企鹅QQ Time Limit: 20 Sec Memory Limit: 256 MBSubmit: 1645 Solved: 616[Submit][Statu ...
- window svn链接
我学会怎么建立window SVN服务器了 今天,终于学会怎么自己搭建SVN服务了,以前一直用的都是公司的SVN服务,没接触过,觉得很神秘,曾经我一个同事弄了好几天,也没搭成,对我打击挺大的:( 觉得 ...
- How to change owner of PostgreSql database?
ALTER DATABASE name OWNER TO new_owner;
- [SoapUI] Post请求Body里面限制特殊字符(&、%),Groovy脚本里特殊字符需要添加“\”转义($)。
SoapUI的Post请求,在body里面不能包含(&.%),如果含有这些特殊字符,请求会报错:在添加的Groovy脚本里有些特殊字符需要使用“\”转义($),不然也会报错.
- Element is not currently visible and so may not be interacted with错误
用selenium定位时,碰到这种错误的原因: 此种问题的关键是在于用className和id都不唯一所以找不到对象 所以,碰到这种问题就换一种定位方式
- 51nod 1051 最大子矩阵和(dp)
题目链接:51nod 1051 最大子矩阵和 实质是把最大子段和扩展到二维.读题注意m,n... #include<cstdio> #include<cstring> #inc ...