E. Anniversary time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of c…
Fibonacci Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13172 Accepted: 9368 Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci seque…
#include<bits/stdc++.h> #define mod 1000000009 using namespace std; typedef long long ll; typedef long long LL; struct Mat { LL mat[3][3]; Mat() { memset(mat,0,sizeof(mat)); } LL* operator [](int x) //注意这种写法 { return mat[x]; } } A; Mat Mut(Mat a,Mat…
先占坑 后面再写详细的 import numpy as np def pow(n): a = np.array([[1,0],[0,1]]) b = np.array([[1,1],[1,0]]) n -= 1 while(n > 0): if (n % 2 == 1): a = np.dot(b, a) b = np.dot(b, b) n >>= 1 return a[0][0] n = int(input()) print(factorial(n))…
Problem D. GukiZ and Binary Operations Solution 一位一位考虑,就是求一个二进制序列有连续的1的种类数和没有连续的1的种类数. 没有连续的1的二进制序列的数目满足f[i]=f[i-1]+f[i-2],恰好是斐波那契数列. 数据范围在10^18,用矩阵加速计算,有连续的1的数目就用2^n-f[n+1] 最后枚举k的每一位,是1乘上2^n-f[n+1],是0乘上f[n+1] 注意以上需要满足 2^l>k.并且这里l的最大值为64,需要特判. #inclu…
D. GukiZ and Binary Operations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We all know that GukiZ often plays with arrays. Now he is thinking about this problem: how many arrays a, of l…
Scout YYF I Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4100 Accepted: 1051 Description YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties,…
M斐波那契数列 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 43 Accepted Submission(s) : 28 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description M斐波那契数列F[n]是一种整数数列,它的定义如下: F[…
Sequence Accepts: 59 Submissions: 650 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description \ \ \ \ Holion August will eat every thing he has found. \ \ \ \ Now there are many foods,but he does…
There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations. Dima is sure that it'll be great to learn to solve the followi…