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

建议使用的浏览器:

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

4953:Periodic Binary String

题目描述
Teacher Mai has an infinite periodic binary string S with index counting from 0. That means S=TTTT..., where T is the period of string S. For example, T="101", then S="101101101101..."

S[l,r] is the sub-string of S. We define f[l,r] is the value when regarding S[l,r] as a binary number.

Please count the number of binary strings T with length k, where T is the period of string S, satisfying the condition: f[l,r]=x (mod p).

The number can be very large, just output the number modulo 1000000007 (10^9+7).
输入解释
There are multiple test cases, terminated by a line "0 0 0 0 0".

For each test case, there is a line contains five numbers p (2<p<10^18, p is a prime number) ,x (0<=x<p), l, r (0<=l<=r<=10^18) and k (1<=k<=10^18).
输出解释
For each test case, output one line "Case #k: ans", where k is the case number counting from 1, ans is the number module 10^9+7.
输入样例
3 0 1 2 1
233 23 2333 23333 23
233 1 1 2 23
0 0 0 0 0
输出样例
Case #1: 2
Case #2: 36003
Case #3: 2097152
来自杭电HDUOJ的附加信息
Author xudyh
Recommend

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

源链接: HDU-4953

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

共提交 0

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