CF1433A.Boring Apartments

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a building consisting of 10 00010~000 apartments numbered from 11 to 10 00010~000, inclusive.

Call an apartment boring, if its number consists of the same digit. Examples of boring apartments are 11,2,777,999911, 2, 777, 9999 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 11, in increasing order (1,11,111,11111, 11, 111, 1111).
  • Next he calls all apartments consisting of digit 22, in increasing order (2,22,222,22222, 22, 222, 2222)
  • And so on.

The resident of the boring apartment xx 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 2222 answered, then our character called apartments with numbers 1,11,111,1111,2,221, 11, 111, 1111, 2, 22 and the total number of digits he pressed is 1+2+3+4+1+2=131 + 2 + 3 + 4 + 1 + 2 = 13.

You have to answer tt independent test cases.

有一栋楼,共有 10 00010~000 套公寓,编号从 11 到 10 00010~000(含端点)。

若一套公寓的编号由相同数字组成,则称其为“无聊的公寓”。例如:1111、22、777777、99999999 等均为无聊的公寓。

我们的主角是个捣蛋鬼,他按如下顺序依次拨打所有无聊公寓的门禁电话,直到有住户接听为止:

  • 首先,他按升序拨打所有仅由数字 11 组成的公寓(即 1, 11, 111, 11111,\ 11,\ 111,\ 1111);
  • 接着,他按升序拨打所有仅由数字 22 组成的公寓(即 2, 22, 222, 22222,\ 22,\ 222,\ 2222);
  • 依此类推。

编号为 xx 的无聊公寓的住户接听了电话,主角随即停止后续所有拨号。

主角想知道他总共按下了多少次数字键(即所有已拨号码的位数之和),你的任务就是帮他计算这个总按键次数。

例如,若编号为 2222 的无聊公寓住户接听了电话,则主角共拨打了编号为 1, 11, 111, 1111, 2, 221,\ 11,\ 111,\ 1111,\ 2,\ 22 的公寓,总按键次数为 1+2+3+4+1+2=131 + 2 + 3 + 4 + 1 + 2 = 13。

你需要处理 tt 个相互独立的测试用例。

输入格式

The first line of the input contains one integer tt (1≤t≤361 \le t \le 36) — the number of test cases.

The only line of the test case contains one integer xx (1≤x≤99991 \le x \le 9999) — the apartment number of the resident who answered the call. It is guaranteed that xx consists of the same digit.

输入的第一行包含一个整数 tt(1≤t≤361 \le t \le 36),表示测试用例的数量。

每个测试用例仅有一行,包含一个整数 xx(1≤x≤99991 \le x \le 9999),表示接电话的居民所住公寓的编号。保证 xx 的各位数字均相同。

输出格式

For each test case, print the answer: how many digits our character pressed in total.

对于每个测试用例,输出答案:我们的角色总共按下了多少个数字。

输入输出样例

  • 输入#1

    4
    22
    9999
    1
    777

    输出#1

    13
    90
    1
    66

输入解题思路,AI测评打分。不知道怎么写?

首页