# 博客

## Problem B

2018-08-09 20:12:07 By hszxoizjn

$F_n~=~s_{n~-~1}\times F_{n~-~1}~+~s_{n~-~2}\times F_{n~-~2}$

$F_0~=~0,~F_1~=~1$

s = (5,3,8,11,5,3,7,11,5,3,8,11,…)

Input

Output

Sample Input

10 8

3

1 2 1

2

7 3

5 4

Sample Output

4

## 评论

Acceptor
@hszxoizjn 您是怎么搞出来滴啊
15632869526

hzoi2017_djw
In the first line there is two numbers $N$ and $Q$. Then in the second line there are $N$ numbers:$a[1]..a[N]$ In the next $Q$ lines,there are two numbers $L,R$ in each line. $N \leq 1000, Q \leq 100000, L \leq R, 1 \leq a[i] \leq 2^{31}-1$
hzoi2017_djw
Dylans is given $N$ numbers $a[1]....a[N]$ And there are $Q$ questions. Each question is like this $(L,R)$ his goal is to find the “inversions” from number $L$ to number $R$. more formally,his needs to find the numbers of pair（$x,y$）, that $L \leq x,y \leq R$ and $x < y$ and $a[x] > a[y]$
VivianWhite

Jumbo
$1\leq i\leq j<k\leq length(S)$
VivianWhite

VivianWhite

Jumbo
Dylans is given $N$ numbers $a[1]....a[N]$ And there are $Q$ questions. Each question is like this $(L,R)$ his goal is to find the “inversions” from number $L$ to number $R$. more formally,his needs to find the numbers of pair（$x,y$）, that $L \leq x,y \leq R$ and $x < y$ and $a[x] > a[y]$ Input In the first line there is two numbers $N$ and $Q$. Then in the second line there are $N$ numbers:$a[1]..a[N]$ In the next $Q$ lines,there are two numbers $L,R$ in each line. $N \leq 1000, Q \leq 100000, L \leq R, 1 \leq a[i] \leq 2^{31}-1$ Output For each query,print the numbers of "inversions” Sample Input 3 2 3 2 1 1 2 1 3 Sample Output 1 3 Hint You shouldn't print any space in each end of the line in the hack data.
hzoi2017_djw
You know that you have $$n$$$bacteria in the Petri dish and size of the $$i$$$-th bacteria is $$a_i$$$. Also you know intergalactic positive integer constant $$K$$$. The $$i$$$-th bacteria can swallow the $$j$$$-th bacteria if and only if $$a_i > a_j$$$and $$a_i \le a_j + K$$$. The $$j$$$-th bacteria disappear, but the $$i$$$-th bacteria doesn't change its size. The bacteria can perform multiple swallows. On each swallow operation any bacteria $$i$$$can swallow any bacteria $$j$$$ if $$a_i > a_j$$$and $$a_i \le a_j + K$$$. The swallow operations go one after another.