#P17074. [ICPC 2017 Shenyang R] New Self-describing Sequence
[ICPC 2017 Shenyang R] New Self-describing Sequence
Problem Description
Let be an integer sequence beginning with . For , is the sum of and the sum of digits of . That’s why we name the sequence a new Self-describing sequence.
The sequence starts with and we also define the prefix sum . For given positive integer , find and .
Input Format
The first line of input consists an integer (), indicating the total number of test cases. Each of the following lines provides an integer ().
Output Format
For each test case output its case label first. Then for given , output and . Since the prefix sum is large, you only need to output . However you should output 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