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

建议使用的浏览器:

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

6226:New Self-describing Sequence

题目描述
Let $a_1, a_2$,... be an integer sequence beginning with $a_1$ = 1. For n ≥ 1, $a_n$+1 is the sum of an and the sum of digits of $a_n$. That’s why we name the sequence a new Self-describing sequence.
The sequence starts with 1, 2, 4, 8, 16, 23, 28, 38, 49, ... and we also define the prefix sum $s_n = a_1 + a_2 + ... + a_n$.
For given positive integer n, find $a_n$ and $s_n$.
输入解释
The first line of input consists an integer T (T ≤ 32768), indicating the total number of test cases. Each of the following T lines provides an integer n (n ≤ 10^17).
输出解释
For each test case output its case label first. Then for given n, output $a_n$ and $s_n$. Since the prefix sum is large,you only need to output $s_n$ mod 1000000009. However you should output $a_n$ as its exact value.
输入样例
7
6
66
666
6666
66666
123456789
31415926535897932
输出样例
Case #1: 23 54
Case #2: 752 20862
Case #3: 10949 3407733
Case #4: 136193 441127485
Case #5: 1698899 717710112
Case #6: 5061289531 990040993
Case #7: 2508156610654066874 660828136
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

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

源链接: HDU-6226

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

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 262144/262144K(Java/Others)