题目描述
In mathematics, the Fibonacci numbers, commonly denoted as fn, is a sequence such that each number is the sum of the two preceding numbers, starting with 1 and 1. That is, f1=1,f2=1 and fn=fn−2+fn−1 (n≥3).
Thus, the beginning of the sequence is 1,1,2,3,5,8,13,21,… .
Given n, please calculate ∑i=1n∑j=i+1ng(fi,fj), where g(x,y)=1 when x⋅y is even, otherwise g(x,y)=0.
输入格式
The only line contains one integer n (1≤n≤109).
输出格式
Output one number -- ∑i=1n∑j=i+1ng(fi,fj).
题目大意
在数学中,斐波拉契数列常被记为数列 fn。该数列的首项 f1,f2 均为 1,并满足递推公式 fn=fn−2+fn−1(n≥3)。
因此,数列的前一些项为 1,1,2,3,5,8,13,21,⋯。
若 x⋅y 为偶数,则函数 g(x,y)=1,否则 g(x,y)=0。求 i=1∑nj=i+1∑ng(fi,fj) 的值。