题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2060 题目描述: There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2) Input Input consists of a sequence of lines, each containing an integer n. (…
两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2) 让你判断第n项是否能被3整除. 1.ZOJ 2723 Semi-Prime http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1723 打表即可. #include<cstdio>…
fibonacci number & fibonacci sequence https://www.mathsisfun.com/numbers/fibonacci-sequence.html http://www.shuxuele.com/numbers/fibonacci-sequence.html fibonacci sequence with cache "use strict"; /** * * @author xgqfrms * @license MIT * @co…
逐渐发现找规律的美妙之处啦,真不错,用普通方法解决很久或者很麻烦的问题,找到规律就很方便,算法最主要还是思想 Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).    Input Input consists of a sequence of lines, each containing an integer n. (n < 1,…
Power of Fibonacci Time Limit: 5 Seconds      Memory Limit: 65536 KB In mathematics, Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers of the following integer sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, .…
题意:定义斐波那契字符串为: $f_1 = $ "a" \(f_2 =\) "b" \(f_n = f_{n-1} + f_{n-2}, \, n > 2\) 例如,$f_3 = $ "ba". 有\(m\)次询问,第\(i\)次给出一个字符串\(s_i\),问\(s_i\)在\(f_n\)中的出现次数. \(m \leq 10^4, \, n \leq 10^{18}, \, \sum|s_i| \leq 10^5\) 主要问题在与\(f…
递推式: \(f_i=1 (1\leq i\leq 2)\) \(f_i=f_{i-1}+f_{i-2}(i>2)\) 一些性质 \(\sum_{i=1}^n f_i=f_{n+2}-1\) \(\sum_{i=1}^n f_i^2=f_nf_{n+1}\) \(\sum_{i=1|i\&1}^{2n-1}=f_{2n}\) \(\sum_{i=2|!(i\&1)}^{2n}=f_{2n+1}-1\) \(f_{n+m}=f_{n}f_{m+1}+f_{m}f_{n-1}\) \(f…
https://vjudge.net/contest/67836#problem/A There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2) Input Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000) Output Print the wo…
参考链接:http://rchardx.is-programmer.com/posts/16142.html vj题目链接:https://vjudge.net/contest/273000#status/kongbursi/L/0/ 题目给出了一个数列的前若干项,要求推测后面的项.我们很容易想到拉格朗日插值法,但是精度就变成了一个大问题. 这个问题虽然保证了所有的值都是整数,但是并没有保证其多项式的系数也是整数,因此在计算方面存在很大的困难. 除了插值法,求解这种数列问题我们有更好的差分方法,…
题意:给出一个字符串,有两种操作: 1.插入一个数字  2.交换两个字符   问最少多少步可以把该字符串变为一个后缀表达式(操作符只有*). 解法:仔细观察,发现如果数字够的话根本不用插入,数字够的最低标准为'*'的个数+1,因为最优是 '12*3*..' 这种形式,所以先判断够不够,不够就补,然后从左往右扫一遍,如果某个时刻Star+1>Num,那么从开始到这一段是不合法的,要把那个'*'与后面的一个数字交换,此时Star--,Num++.然后步数++.这样得出的结果就是最后的最小步数. 脑子…