最近手感有点差,所以做点水题来锻炼一下信心. 下周的南京区域赛估计就是我的退役赛了,bless all. Revenge of Fibonacci Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 204800/204800 K (Java/Others)Total Submission(s): 1582    Accepted Submission(s): 356 Problem Description The well-know…
Revenge of Fibonacci 题意:给定fibonacci数列的前100000项的前n位(n<=40);问你这是fibonacci数列第几项的前缀?如若不在前100000项范围内,输出-1: 思路:直接使用数组模拟加法,再用Trie树插入查找即可:但是一般使用new Trie()的代码都是MLE的.反而我之前写的,直接得到数组大小的maxnode版本的内存可以接受:并且还有一点就是前40位的精度问题:由于是自己计算出来的finboncci数列,并不是系统给的,所以1的进位不会形成很长…
Revenge of Fibonacci Problem Description The well-known Fibonacci sequence is defined as following: Here we regard n as the index of the Fibonacci number F(n).  This sequence has been studied since the publication of Fibonacci's book Liber Abaci. So…
将斐波那契的前100000个,每个的前40位都插入到字典树里(其他位数删掉),然后直接查询字典树就行. 此题坑点在于 1.字典树的深度不能太大,事实上,超过40在hdu就会MLE…… 2.若大数加法时,保存的位数过少,就会导致低位误差,累积起来就可能导致前40位产生错误,解决办法是提高精度. #include<iostream> #include<cstring> #include<string> #include<cstdio> using namespa…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4099 这个题目就是一个坑或. 题意:给你不超过40的一串数字,问你这串数字是Fibonacci多少的开头几位数字,如果不存在则输出-1. 题解:明明说好的不超过40,但是在建字典数的时候不加i<41就超内存了,杭电你是想咋地,害的我比较好多人的代码,一点一点试出来的. AC代码: #include <iostream> #include <cstdio> #include <…
题意:对给定前缀(长度不超过40),找到一个最小的n,使得Fibonacci(n)前缀与给定前缀相同,如果在[0,99999]内找不到解,输出-1. 思路:用高精度加法计算斐波那契数列,因为给定前缀长度不超过40,所以高精度计算时每次只需保留最高60位,每次将得到的值插入到字典树中,使得树上每个节点只保留最小的n值.查询输出字典树结点的值. #include<cstdio> #include<cstring> #include<iostream> #define MAX…
Problem Description A Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1. F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) + F(n-3) + F(n-4) Your task is to take…
描述 The well-known Fibonacci sequence is defined as following: Here we regard n as the index of the Fibonacci number F(n).This sequence has been studied since the publication of Fibonacci's book Liber Abaci. So far, many properties of this sequence ha…
大水题 #include<time.h> #include <cstdio> #include <iostream> #include<algorithm> #include<math.h> #include <string.h> #include<vector> #include<queue> typedef long long int ll; using namespace std; ll f[]; int…
Revenge of Fibonacci Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 204800/204800 K (Java/Others)Total Submission(s): 3218    Accepted Submission(s): 821 Problem Description The well-known Fibonacci sequence is defined as following: Here we…