308101: CF1467A. Wizard of Orz
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Wizard of Orz
题意翻译
直线上有 $n$ 个数字面板。每个面板可以显示 $0$ 到 $9$ 之间的任何数字。最初,所有面板都显示 $0$ 。 每秒钟,每个面板显示的数字增加 $1$ 。也就是说,在每秒结束时,显示 $9$ 的面板现在显示 $0$ ,显示 $0$ 的面板现在显示 $1$ ,显示 $1$ 的面板现在显示 $2$ ,依此类推。 面板暂停时,面板上显示的数字在接下来不会改变。 您可以在任何时间暂停这些面板中的一个。然后,与之相邻的面板在 $1$ 秒钟后暂停,与它相邻的面板的相邻的面板在 $2$ 秒后暂停,依此类推。也就是说,如果您暂停面板 $x$ ,则面板 $y$ 将在 $|x-y|$ 秒钟后暂停。 例如,假设有 $4$ 个面板,当数字 $9$ 在第 $3$ 个面板上时,它被暂停了。 - 面板 $1$ 在 $2$ 秒后暂停,因此它的数字为 $1$ ; - 面板 $2$ 在 $1$ 秒后暂停,因此它的数字是 $1$ ; - 面板 $4$ 在 $1$ 秒后暂停,因此它的数字为 $0$ 。 所得的 $4$ 位数字为 $1090$ 。注意,对于 $n = 4$ ,这个例子不是最佳的。 暂停所有面板后,您可以从左到右书写显示在面板上的数字,以形成一个 $n$ 位数(可以由前导零组成)。您可以获得的最大数字是多少?最初,所有面板都显示 $0$ 。题目描述
There are $ n $ digital panels placed in a straight line. Each panel can show any digit from $ 0 $ to $ 9 $ . Initially, all panels show $ 0 $ . Every second, the digit shown by each panel increases by $ 1 $ . In other words, at the end of every second, a panel that showed $ 9 $ would now show $ 0 $ , a panel that showed $ 0 $ would now show $ 1 $ , a panel that showed $ 1 $ would now show $ 2 $ , and so on. When a panel is paused, the digit displayed on the panel does not change in the subsequent seconds. You must pause exactly one of these panels, at any second you wish. Then, the panels adjacent to it get paused one second later, the panels adjacent to those get paused $ 2 $ seconds later, and so on. In other words, if you pause panel $ x $ , panel $ y $ (for all valid $ y $ ) would be paused exactly $ |x−y| $ seconds later. For example, suppose there are $ 4 $ panels, and the $ 3 $ -rd panel is paused when the digit $ 9 $ is on it. - The panel $ 1 $ pauses $ 2 $ seconds later, so it has the digit $ 1 $ ; - the panel $ 2 $ pauses $ 1 $ second later, so it has the digit $ 0 $ ; - the panel $ 4 $ pauses $ 1 $ second later, so it has the digit $ 0 $ . The resulting $ 4 $ -digit number is $ 1090 $ . Note that this example is not optimal for $ n = 4 $ . Once all panels have been paused, you write the digits displayed on them from left to right, to form an $ n $ digit number (it can consist of leading zeros). What is the largest possible number you can get? Initially, all panels show $ 0 $ .输入输出格式
输入格式
The first line of the input contains a single integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. Each test case consists of a single line containing a single integer $ n $ ( $ 1 \le n \le 2\cdot10^5 $ ). It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2\cdot10^5 $ .
输出格式
For each test case, print the largest number you can achieve, if you pause one panel optimally.
输入输出样例
输入样例 #1
2
1
2
输出样例 #1
9
98