欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1467A.Wizard of Orz
Wizard of Orz
There are digital panels placed in a straight line. Each panel can show any digit from to . Initially, all panels show .
Every second, the digit shown by each panel increases by . In other words, at the end of every second, a panel that showed would now show , a panel that showed would now show , a panel that showed would now show , 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 seconds later, and so on. In other words, if you pause panel , panel (for all valid ) would be paused exactly seconds later.
For example, suppose there are panels, and the -rd panel is paused when the digit is on it.
- The panel pauses seconds later, so it has the digit ;
- the panel pauses second later, so it has the digit ;
- the panel pauses second later, so it has the digit .
The resulting -digit number is . Note that this example is not optimal for .
Once all panels have been paused, you write the digits displayed on them from left to right, to form an digit number (it can consist of leading zeros). What is the largest possible number you can get? Initially, all panels show .
Input
The first line of the input contains a single integer () — the number of test cases. Each test case consists of a single line containing a single integer ().
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, print the largest number you can achieve, if you pause one panel optimally.
Note
In the first test case, it is optimal to pause the first panel when the number is displayed on it.
In the second test case, it is optimal to pause the second panel when the number is displayed on it.
Samples
2
1
2
9
98
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |