HDUOJ 2672---god is a girl 《斐波那契数》
2024-09-17 22:12:57
god is a girl
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1135 Accepted Submission(s): 514
Problem Description
One day,when I was dreaming,god went into my dream,she was pretty cute,just like /^_^\... 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. ...
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
There is multy cases,please process to EOF. Each case is one line of string with uppercase letters and white spaces and other symbols.
Output
One line of the decoded string.
Sample Input
SGC CGGJX GC BMHVQ BGU BCIHNYNBX GNPLV!
Sample Output
THE FLOWS OF MAGIC ARE WHIMSICAL TODAY!
Author
Teddy
做了两小时,一直在找规律,最后将几个句子反复对比才发现是fibonacci数的引用.....哎!!,没有多大的技巧,所以代码也没有啥好讲解的...
就是先暴力一下打一张漂亮的斐波列数表,当然数据范围是在0~25之间----为防止‘A’+25不至于超出范围,当然其他数据如‘B’+25超出了范围,则
要减去26直到最后的数不大于‘Z’即可。
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#pragma warning (disable: 4018)
#define MAX 10000
char str[MAX+];
int arr[MAX+]={,,};
int main()
{
int i,j;
for( i=;i<=MAX;i++)
{
arr[i]=arr[i-]+arr[i-];
arr[i]%=;
}
while(gets(str)!=NULL)
{
for( j=,i=;i<strlen(str);i++)
{
if(isupper(str[i]))
{
str[i]+=arr[j++];
while(str[i]>'Z')
{
str[i]-=;
} }
putchar(str[i]);
}
puts("");
}
return ;
}
最新文章
- 萌新笔记——linux下查看内存的使用情况
- 4412开发板学习笔记-NFS服务器的搭建
- 软件工程—我的IT的新篇章
- 程序Bug---易错点
- 简单使用SQLite 的增删改查
- unity3d模型制作规范
- 增加字段关联插件 For PHPCMS V9 免费版
- android SurfaceView绘制 重新学习--基础绘制
- mysql 异常处理实例
- 跟着内核学框架-从misc子系统到3+2+1设备识别驱动框架
- 移动端 canvas插入多张图片生成一张可保存到手机图片
- 使用lamdba函数对list排序
- [Kafka] [All about it]
- mysql链接服务器,update报错
- 单源最短路——Dijkstra模板
- #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
- Mac Lion Configure Apache
- Django:Django Rest Framework
- 基于Tomcat 的WEB Project存在的安全漏洞总结
- 关于虚拟机安装mac os 教程详解