http://poj.org/problem?id=2506 #include <iostream> #include <stdio.h> #include <string.h> #include <stdlib.h> using namespace std; ][]; int main() { int n,i,j; memset(a,,sizeof(a)); a[][]=; a[][]=; a[][]=; ; i<=; i++) { ; j<=…
占坑 先贴上AC代码 回头来补坑 #include <iostream> using namespace std; int n, k; const int mod = 100003; long long f[1000000]; int main() { cin >> n >> k; f[0] = 1; for (int i = 1; i <= n; i++) { if (i <= k) { //当 当前阶梯 小于一次性可以跨越的阶梯的时候 for (int…
题意: 传送门 已知\(F(n)=3F(n-1)+2F(n-2) \mod 998244353,F(0)=0,F(1)=1\),给出初始的\(n_1\)和询问次数\(q\),设每一次的答案\(a_i=F(n_i)\),而\(n_{i+1}=n_i\oplus(a_i*a_i)\),求\(a_1\oplus a_2\dots\oplus a_q\). 思路: 原式是一个二次常数递归式,我们可以求得它的通项为: \[F(n)=\frac{1}{\sqrt{17}}[(\frac{3+\sqrt{17…
题目大意: F[0]=0 F[1]=1 F[n+2]=F[n+1]+F[n] 求F[n] mod 104. F[n+2] F[n+1] = 1 1 1 0 * F[n+1] F[n] 记这个矩阵为A,则有: F[n+1] F[n] = An * F[1] F[0] = An * 1 0 然后可以快速幂 #include<cstdio> #include<vector> using namespace std; typedef vector<int> vec; typed…
#include "stdio.h" #include "iostream" int Fibonacci(int n) { int t1, t2; || n == ) { ; } else { t1 = Fibonacci(n-); t2 = Fibonacci(n-); return t1 + t2; } } int main() { int n, num; scanf("%d",&n); num = Fibonacci(n); pri…
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=259#problem/C Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n >= 3) Given two numbers a and b, calculate how many Fibonacci numbers are in the…
java大数做斐波那契数列:  思路:1.       2.可以用数组存着 import java.math.BigInteger; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner cin=new Scanner(System.in); while(cin.hasNext()){//remermber BigInteger num1=cin.nextBigI…
Problem Description   度熊面前有一个全是由1构成的字符串,被称为全1序列.你可以合并任意相邻的两个1,从而形成一个新的序列.对于给定的一个全1序列,请计算根据以上方法,可以构成多少种不同的序列.   Input 这里包括多组测试数据,每组测试数据包含一个正整数N,代表全1序列的长度. 1≤N≤200   Output 对于每组测试数据,输出一个整数,代表由题目中所给定的全1序列所能形成的新序列的数量.   Sample Input 1 3 5   Sample Output…
Tiling Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7965   Accepted: 3866 Description In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rectangle. Input Input is a sequence of lines,…
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…