欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1433A.Boring Apartments
Boring Apartments
There is a building consisting of apartments numbered from to , inclusive.
Call an apartment boring, if its number consists of the same digit. Examples of boring apartments are and so on.
Our character is a troublemaker, and he calls the intercoms of all boring apartments, till someone answers the call, in the following order:
- First he calls all apartments consisting of digit , in increasing order ().
- Next he calls all apartments consisting of digit , in increasing order ()
- And so on.
The resident of the boring apartment answers the call, and our character stops calling anyone further.
Our character wants to know how many digits he pressed in total and your task is to help him to count the total number of keypresses.
For example, if the resident of boring apartment answered, then our character called apartments with numbers and the total number of digits he pressed is .
You have to answer independent test cases.
Input
The first line of the input contains one integer () — the number of test cases.
The only line of the test case contains one integer () — the apartment number of the resident who answered the call. It is guaranteed that consists of the same digit.
Output
For each test case, print the answer: how many digits our character pressed in total.
Samples
4
22
9999
1
777
13
90
1
66
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |