大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
Description
I really wanted to talked to her,but my English was so poor and she was not a national god but a foreign one…After thirty minutes,she flew away…but story was not finished here,she had left a letter for me!!!What puzzled me so much is the letter was encoded.I had thought for many days,but still can’t get it. Now I turn to you for help,with some limited prompts,can you help me to decode the whole letter?
Prompts:
GDJIJ,EL SSJT UT YWOSQNIVZMI. -> HELLO,MY NAME IS LINDAINVERS.
CN WLP JRVMFGQ BVR,IJCFI? -> DO YOU REQUIRE AID,HUMAN?
NMAB VYNNF, FI’E VC HP IXJ ZLQZI. -> ONCE AGAIN, IT’S UP TO THE ELVES.
…
Input
Each case is one line of string with uppercase letters and white spaces and other symbols.
Output
Sample Input
SGC CGGJX GC BMHVQ BGU BCIHNYNBX GNPLV!
Sample Output
THE FLOWS OF MAGIC ARE WHIMSICAL TODAY!
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include<cstdio>
#include<iostream>
#include <map>
using namespace std;
char a[50]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char s[1000010],b;
int i,chan,num=0;
int f[100010],x,j;
int main()
{
f[0]=1;
f[1]=1;
for(int i=2;i<=100000;i++)
f[i] = (f[i-1]%26+f[i-2]%26)%26;
while(gets(s)!=NULL)
{
num = 0;
chan=strlen(s);
for(i=0;i<chan;i++)
{
if(s[i]<'A'||s[i]>'Z')
printf("%c",s[i]);
else
{
for(j=0;j<=25;j++)
if(s[i]==a[j])
{
x=j;
break;
}
x+=f[num];
x=x%26;
printf("%c",a[x]);
num++;
}
}
printf("\n");
}
return 0;
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/184595.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...