当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6363:bookshelf

题目描述
Patrick Star bought a bookshelf, he named it ZYG !!

Patrick Star has $N$ book .

The ZYG has $K$ layers (count from $1$ to $K$) and there is no limit on the capacity of each layer !

Now Patrick want to put all $N$ books on ZYG :

1. Assume that the i-th layer has $cnt_i(0 \le cnt_i \le N)$ books finally.

2. Assume that $f[i]$ is the i-th fibonacci number ($f[0] = 0, f[1] = 1, f[2] = 1, f[i] = f[i - 2] + f[i - 1]$).

3. Define the stable value of i-th layers $stable_i = f[cnt_i]$.

4. Define the beauty value of i-th layers $beauty_i = 2^{stable_i} - 1$.

5. Define the whole beauty value of ZYG $score = gcd(beauty_1, beauty_2, ..., beauty_k)$(Note: $gcd(0, x) = x$).

Patrick Star wants to know the expected value of $score$ if Patrick choose a distribute method randomly !
输入解释
The first line contain a integer $T$ (no morn than 10), the following is $T$ test case, for each test case :

Each line contains contains three integer $n, k(0 < n, k \le 10^6)$.
输出解释
For each test case, output the answer as a value of a rational number modulo $10^9 + 7$.

Formally, it is guaranteed that under given constraints the probability is always a rational number $\frac{p}{q}$ (p and q are integer and coprime, q is positive), such that q is not divisible by $10^9 + 7$. Output such integer a between 0 and $10^9+6$ that $p-aq$ is divisible by $10^9+7$.
输入样例
1
6 8
输出样例
797202805
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6363

最后修改于 2020-10-25T23:30:40+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)