给定 𝑛 组询问,每组询问给定两个整数 𝑎,𝑏,请你输出  的值。
输入格式
第一行包含整数 𝑛。
接下来 𝑛 行,每行包含一组 𝑎 和 𝑏。
输出格式
共 𝑛 行,每行输出一个询问的解。
数据范围
1≤n≤10000,
 1≤b≤a≤
输入样例:
3
3 1
5 3
2 2
输出样例:
3
10
1代码:
#include<iostream>
using namespace std;
const int N = 100010,mod = 1e9 + 7;
int fact[N],revfact[N];
int n,a,b;
int QuickMOD(int a,int b,int p){
    int res = 1;
    while(b != 0){
        if((b & 1) == 1){
            res = (long long) res * a % p;
        }
        a = (long long) a * a % p;
        b /= 2;
    }
    return res;
}
int main(){
    cin>>n;
    fact[0] = revfact[0] = 1;
    for(int i = 1;i < N;i ++){
        fact[i] = (long long) fact[i - 1] * i % mod;
        revfact[i] = (long long) revfact[i - 1] * QuickMOD(i, mod - 2, mod) % mod;
    }
    while(n--){
        cin>>a>>b;
        cout<<(long long) fact[a] * revfact[b] % mod * revfact[a - b] % mod<<endl;
    }
    return 0;
}

















