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. ...
 
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 ;
}

HDUOJ 2672---god is a girl 《斐波那契数》的更多相关文章

  1. UVA 11582 Colossal Fibonacci Numbers! 大斐波那契数

    大致题意:输入两个非负整数a,b和正整数n.计算f(a^b)%n.其中f[0]=f[1]=1, f[i+2]=f[i+1]+f[i]. 即计算大斐波那契数再取模. 一开始看到大斐波那契数,就想到了矩阵 ...

  2. 斐波那契数[XDU1049]

    Problem 1049 - 斐波那契数 Time Limit: 1000MS   Memory Limit: 65536KB   Difficulty: Total Submit: 1673  Ac ...

  3. C++求斐波那契数

    题目内容:斐波那契数定义为:f(0)=0,f(1)=1,f(n)=f(n-1)+f(n-2)(n>1且n为整数) 如果写出菲氏数列,则应该是: 0 1 1 2 3 5 8 13 21 34 …… ...

  4. Project Euler 104:Pandigital Fibonacci ends 两端为全数字的斐波那契数

    Pandigital Fibonacci ends The Fibonacci sequence is defined by the recurrence relation: F[n] = F[n-1 ...

  5. DP:斐波纳契数

    题目:输出第 n 个斐波纳契数(Fibonacci) 方法一.简单递归 这个就不说了,小n怡情,大n伤身啊……当n=40的时候,就明显感觉到卡了,不是一般的慢. //输出第n个 Fibonacci 数 ...

  6. HDU4549 M斐波那契数

    M斐波那契数列 题目分析: M斐波那契数列F[n]是一种整数数列,它的定义例如以下: F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 如今给 ...

  7. HDU 5914 Triangle(打表——斐波那契数的应用)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Problem Description Mr. Frog has n sticks, whos ...

  8. [Swift]LeetCode509. 斐波那契数 | Fibonacci Number

    The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such th ...

  9. HDU 1021(斐波那契数与因子3 **)

    题意是说在给定的一种满足每一项等于前两项之和的数列中,判断第 n 项的数字是否为 3 的倍数. 斐波那契数在到第四十多位的时候就会超出 int 存储范围,但是题目问的是是否为 3 的倍数,也就是模 3 ...

随机推荐

  1. 【转载】创建和使用动态链接库 (C++)

    原文:http://blog.csdn.net/handforcpp/article/details/3478254 也可参考MSDN: 演练:创建和使用动态链接库 (C++) 我们将创建的第一种类型 ...

  2. sequenza细胞纯度计算

    安装sequenza bam文件要放在前面,否侧会-f命令可能识别错误 samtools mpileup a.bam -f hg19.fasta -Q 20 |gzip > normal.pil ...

  3. bzoj 1054: [HAOI2008]移动玩具 bfs

    1054: [HAOI2008]移动玩具 Time Limit: 10 Sec  Memory Limit: 162 MB[Submit][Status][Discuss] Description 在 ...

  4. AngularJS Protractor

    官网地址:http://www.protractortest.org/ 1. 预备环境 protractor 是一个 Node.js 程序,为了运行 protractor ,你首先需要 Node 环境 ...

  5. jQuery中的遍历

    在原生javascript中我们用的最多的遍历就是for,但是在jQuery里面有个方法比for还有强大,它就是我们经常看到的each()方法,当然了如果考虑性能方面的话还是建议用for来进行元素的遍 ...

  6. iOS - OC 术语表

    1.术语表

  7. Data Science 和 Finance 两个领域的融合是什么样子的?

    Data Science 和 Finance 两个领域的融合是什么样子的? 2015-05-24 董可人 现在大部分人所说的Quant一般是指各大投行里做衍生品定价,信用评估,风险控制之类工作的人,这 ...

  8. Vsftpd服务的搭建

    安装vsftpd服务程序 yum install vsftpd -y Vsftpd的程序与配置文件: 主程序 /usr/sbin/vsftpd 用户禁止登陆列表 /etc/vsftpd/ftpuser ...

  9. C++—函数探幽

    一.内联函数 1.内联函数的机制 内联函数是C++为提高程序运行速度而做的一项改进. 函数调用机制:常规函数调用使程序使程序跳到被掉函数的地址,并在函数结束时返回. 内联函数的机制:内联函数的代码与其 ...

  10. linux 文件类型 文件权限

    linux中常见的文件类型有: “—”表示普通文件 :-rw-r--r-- 1 root root 41727 07-13 02:56 install.log   “d”表示目录 :drwxr-xr- ...