8484: Random

内存限制:64 MB 时间限制:5 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:4 通过:1

题目描述

N numbers, randomly generated between [0,1]
Make M operation,1/2probability to delete the maximum value,1/2probability to delete the minimum
value
Calculate the sum of expected value module 10 9 + 7

输入格式

Each test contains multiple test cases. The first line contains the number of test cases T(1 ≤ T ≤ 10000).
Description of the test cases follows.
The first line of each test case contains two integers n,m
1 ≤ m ≤ n ≤ 10 9

输出格式

For each test case, print one integer — the answer to the problem.

输入样例 复制

2
2 2
3 1

输出样例 复制

0
1

分类标签