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

建议使用的浏览器:

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

6618:Good Numbers

题目描述
Let’s consider a number N is good if and only if the occurrence of each digit is multiple of 3 in the octonal representation of N.
You are good at math, so we want to ask you to calculate how many good numbers with K digits in octonal representation, which are multiple of P. This number may be huge, so you are only to print it modulo 10^9 + 9.
Note that good numbers should be positive and should not have any leading zeroes.
For example, suppose K = 3 and P = 2, good numbers are 222(8), 444(8) and 666(8). 111(8) is not good because it is not the multiple of 2. 102(8) is not good because 1 occurs once, not multiple of 3.
输入解释
There are multiple (at most 100) test cases. Please process until EOF (end of file).
Each test case contains 2 integers K (1 <= K <= 10^18, K is divisible by 3), P (<8).
At most 15 test cases are big. (K > 1000).
输出解释
For each test case, print a single integer denoting the answer in one line.
输入样例
3 1
3 2
输出样例
7
3
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6618

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

共提交 0

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