首页 技术 正文
技术 2022年11月19日
0 收藏 446 点赞 4,493 浏览 2392 个字

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1780    Accepted Submission(s): 635

Problem DescriptionAfter Gardon had got Angel’s letter, he found it was encoded…Oh my god, why did she encode a love-letter?? But don’t worry, she wrote the algorithm for encoding after the letter:
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? InputThe letter will begin with the keyword (All uppercase), then lines of text. OutputDecode 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 InputANGELFxlr jxaj eac W xlam cqim hqwglW xahl kqsl kplgwat zlltwryTlj sl atfack jxwru W eqr’j farra zqmylj cqiW mlslsnlm aj jxl eacCqi aml atfack qr sc swreLhlrjxqiyx W vikj gar jxwru anqij cqiWz jxl eac wr jxl zijimlJxwk tqhl fwtt nlgqswry jmilW’hl rlhlm gxaryl sc swre jxaj W fwtt tqhl cqi zqmlhlmW eqr’j gaml xqf zqqt wj wkW fwtt tlj sc emlas gqsl jmilW fwtt jltt cqi kqsljxwry W farra tlj cqi urqf,W tlj cqi urqf W tqhl cqi, tqhwry cqi, ak jxl sqikl tqhlk jxl mwglLhlr lhlmc eac xak kjqms,W fwtt atfack nc cqim kwelW swkk cqi, swkkwry cqiW eqr’j gaml xqf xame wj wkW vikj farj cqi jq nl xappcLhlmcjxwry, W eq wj zqm cqi Sample OutputWhen that day I hear your voiceI have some special feelingLet me always think I don’t wanna forget youI remember at the dayYou are always on my mindEventhough I just can think about youIf the day in the futureThis love will becoming trueI’ve never change my mind that I will love you foreverI don’t care how fool it isI will let my dream come trueI will tell you something I wanna let you know, I let you know I love you, loving you, as the mouse loves the riceEven every day has storm, I will always by your sideI miss you, missing youI don’t care how hard it is I just want you to be happyEverything, I do it for you

 #include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char sh[],s[];
char c;
int i,j,k,l,m,n;
void ac(char sh[])
{
l=strlen(sh);
for(i=;i<l;i++)
if(sh[i]>='a'&&sh[i]<='z')
sh[i]-=;//先变成大写
for(i=;i<l;i++)
s[i]=sh[i];
int flag=;
for(i=;i>=;i--)//得到密码字符串
{
for(j=;j<l;j++)
if('Z'-i==sh[j])
break;
if(j==l)
s[flag--]='Z'-i;
}
}
int main()
{
scanf("%s",sh);
getchar();
ac(sh);
while(scanf("%c",&c)!=EOF)//逐个字母输入
{
for(i=;i<;i++)
{
if(c==s[i])
{
printf("%c",'A'+i);
break;
} if(c==s[i]+)
{
printf("%c",'a'+i);
break;
}
}
if(i==)
printf("%c",c);
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,958
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,482
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,328
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,111
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,743
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,777