SP13978 BBM - Billion ByteMan March

题目描述

首先输入的是 $2^{12}$ 个已经预先计算好的值,这些值是 $i$ 的阶乘模 $M7$ 的结果,其中 $i$ 取自区间 $[0, 2^{30})$ 且步长为 $2^{18}$。依次每个结果占一行。接下来的一行中给出了一个整数 $T$,代表测试用例的数量。接下来的 $T$ 行中,每一行包含两个整数 $N$ 和 $K$。其中,$N$ 表示参加聚会的公交车数量,$K$ 表示每辆公交车的乘客容量。 对于每个测试用例,你需要计算可以将人们组成同一队伍的不同方式的数量。

输入格式

The input starts with 2^12 useful precomputed values: factorial(i) MOD M7 for i in \[0 ; 2^30\[ with a step of 2^18, each one on one line. The input continues with the number T of test cases in a single line. In each of the next T lines there are two integers : N, K. N is the quantity of bus that came to the meeting. K is the common capacity of each bus.

输出格式

For each test case, your task is to calculate the number of ways people can form homogeneous teams.

说明/提示

- 测试用例数 $T \leq 10^5$ - $0 \leq N, K < 2^{30}$ **本翻译由 AI 自动生成**