T150191 求和

QQ图片20201005153120.jpg

结论:对于n,答案为\(F_{2^n}\)

呃,其实找规律也能找出来的

#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
long long t;
long long n[1001];
long long nm;
long long f[1000001],c[1000001];
const long long mod=1000000007;
//const double modc=1000000007;
//long long c;
long long x;
long long d;
long long ans;
int main(){
	scanf("%lld",&t);
	for(long long i=1;i<=t;++i){
		scanf("%lld",&n[i]);
		nm=max(nm,n[i]);
	}
	f[0]=f[1]=1;
	c[0]=1;
	c[1]=1;
	for(long long i=2;i<=2*nm;++i){
		f[i]=f[i-1]+f[i-2];
		f[i]%=mod;
	}
	for(long long i=1;i<=t;++i){
		cout<<f[2*n[i]]<<endl;
	}
	return 0;
}
/*
*/ 

posted @ 2020-10-05 15:42  Simex  阅读(78)  评论(0编辑  收藏  举报