A Tsinghua midterm exam question (escape)

According to the teacher jzh who gave the question...

Summation
[Problem description] The
number of combinations C(n,m) is the number of solutions to take m items from n items . C(n,m)=(n!)/(m!(nm)!) Fibonacci sequence F satisfies, F[0]=F[1]=1 , F[n]=F when n 2 [n-1]+F[n-2] gives n , find C(n,0)F[0]+C(n,1)F[1]+…+C(n,n)F[n ] [Input format] One line with a number T represents the number of data groups Next T lines have one number in each line, representing n [Output format] Output T lines, one number in each line represents the answer, modulo 10^9+7 [Example Input] 3 2 5 1000 [Example output] 5 89 276439883















[Data scale and convention]
For 30% of the data, n<=10
for 60% of the data, n<=1000
for 100% of the data, T<=1000 , n<=10^6

 

【Calm analysis】

30% of the points can be violent, because Fibonacci is the most well-known recursive formula, but there is actually a direct general term formula;

However, this question is a conclusion, which can be proved by the following:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325386157&siteId=291194637