#P9930. [NFLSPC #6] 1064 病毒
[NFLSPC #6] 1064 病毒
Background
Your computer has been infected with the 1064 virus, and now all numbers stored on your computer have started to collapse.
To destroy your computer more thoroughly, for an -digit number in decimal, the evil 1064 virus will iterate it by some rule at least times, to make sure you cannot recover it.
Facing the 1064 virus, you are at a loss. But as an OIer, you want to know dao dao dao dao dao dao dao dao dao dao dao dao dao dao dao dao dao.
Problem Description
A digit string is defined as a string that contains only digits . Odd digits are , and even digits are .
For a digit string , let the numbers of odd digits, even digits, and total digits in it be , respectively. Then . Define as the digit string obtained by writing in order, without ignoring leading zeros. For example, , , , .
Let denote: first write the number into a digit string ignoring leading zeros, then iterate for times, and take the number represented by the resulting digit string. That is, let (there are applications of ), then is the result of converting into a number.
Given (guaranteed ), compute .
There are multiple test cases.
Input Format
The first line contains an integer .
The next lines each contain two integers , representing one test case.
Output Format
For each test case, output one integer per line, representing the answer.
1
0 1
11
Hint
For all testdata, , , .
- Subtask 1 ( points): , .
- Subtask 2 ( points): no special constraints.
Source: NFLSPC #6 F by Alex_Wei
Translated by ChatGPT 5