大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
god is a girl
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1337 Accepted Submission(s): 618
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.
…
Each case is one line of string with uppercase letters and white spaces and other symbols.
SGC CGGJX GC BMHVQ BGU BCIHNYNBX GNPLV!
THE FLOWS OF MAGIC ARE WHIMSICAL TODAY!
#include<stdio.h>
#include<string.h>
int main()
{
char str1[100000],str2[100000];
int a[100000],i,t,j;
memset(str1,0,sizeof(str1));
while(gets(str1))
{
memset(a,0,sizeof(a)); 清零应放在while内
memset(str2,0,sizeof(str2));
t=strlen(str1);
a[0]=1;
a[1]=1;
for(i=2;i<t;i++)
{
a[i]=a[i-1]+a[i-2];
while(a[i]>26)
a[i]-=26;
}
for(i=0,j=0;i<t;i++)
{
if(str1[i]>='A'&&str1[i]<='Z')
{
str2[i]=str1[i]+a[j++];
if(str2[i]>'Z')
str2[i]-=26;
}
else
str2[i]=str1[i];
}
puts(str2);
}
return 0;
}
<pre name="code" class="html">#include<stdio.h>
#include<string.h>
int main()
{
char str1[100000] ;
int a[100000],i,t,j;
while(gets(str1))
{
t=strlen(str1);
a[0]=1;
a[1]=1;
for(i=2;i<t;i++)
{
a[i]=a[i-1]+a[i-2];
while(a[i]>26)
a[i]-=26;
}
for(i=0,j=0;i<t;i++)
{
if(str1[i]>='A'&&str1[i]<='Z')
{
str1[i]+=a[j++];
if(str1[i]>'Z')
str1[i]-=26;
}
}
puts(str1);
}
return 0;
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/184519.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...