编程介的小学生 2019-06-10 21:14 采纳率: 20.5%
浏览 231

计算斐波拉契数列的区间和的问题,要求计算大数的方式实现怎么用的C语言的程序编写代码的形式的思路

Problem Description
We all know the definition of Fibonacci series: fib[i]=fib[i-1]+fib[i-2],fib[1]=1,fib[2]=1.And we define another series P associated with the Fibonacci series: P[i]=fib[4*i-1].Now we will give several queries about P:give two integers L,R, and calculate ∑Pi.

Input
There is only one test case.
The first line contains single integer Q – the number of queries. (Q<=10^4)
Each line next will contain two integer L, R. (1<=L<=R<=10^12)

Output
For each query output one line.
Due to the final answer would be so large, please output the answer mod 1000000007.

Sample Input
2
1 300
2 400

Sample Output
838985007
352105429

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试
    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元