-->
当前位置:首页 > 题库

PROGRAMMING:Magical cycle

Luz5年前 (2021-05-10)题库375
We know that in programming, we often need to consider the time complexity, especially for the loop part. For example,
If the
for(i=1; i<=n; i++) OP ;
Then we do OP operation n times, and if the
for(i=1; i<=n; i++)
for(j=i+1; j<=n; j++) OP;
So we do n * (n-1) / 2 OP operations.
Now you know that there is a m-layer for loop operation, and the starting value of each variable in for is the starting value of the previous variable + 1 (the starting value of the first variable is 1), and the ending value is an input n. how much computation does the final OP have.
###Input format:
There are t groups of data, T < = 10000 (end when t = 0). Each group has two integers m and N, 0 < m < = 2000, 0 < n < = 2000
###Output format:
For each group of data, output a value, indicating the total amount of calculation, maybe this number is very large, then you only need to output the remainder left by dividing 1007.
###Input example:
Here is a set of inputs. For example:
```in
two
1 3
2 3
```
###Output example:
The corresponding output is given here. For example:
```out
three
three
```







answer:If there is no answer, please comment