codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1926C.md (1219B)


      1 Source: https://codeforces.com/problemset/problem/1926/C
      2 
      3 C. Vlad and a Sum of Sum of Digits
      4 
      5 time limit per test
      6 
      7 0.5 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Please note that the time limit for this problem is only 0.5 seconds per test.
     22 
     23 Vladislav wrote the integers from $1$ to $n$, inclusive, on the board. Then he replaced each integer with the sum of its digits.
     24 
     25 What is the sum of the numbers on the board now?
     26 
     27 For example, if $n=12$ then initially the numbers on the board are: $$1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12.$$ Then after the replacement, the numbers become: $$1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3.$$ The sum of these numbers is $1+2+3+4+5+6+7+8+9+1+2+3=51$. Thus, for $n=12$ the answer is $51$.
     28 
     29 Input
     30 
     31 The first line contains an integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.
     32 
     33 The only line of each test case contains a single integer $n$ ($1 \leq n \leq 2 \cdot 10^5$) — the largest number Vladislav writes.
     34 
     35 Output
     36 
     37 For each test case, output a single integer — the sum of the numbers at the end of the process.
     38 
     39 Example
     40 
     41 Input
     42 
     43 ```
     44 7
     45 
     46 12
     47 
     48 1
     49 
     50 2
     51 
     52 3
     53 
     54 1434
     55 
     56 2024
     57 
     58 200000
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 51
     65 1
     66 3
     67 6
     68 18465
     69 28170
     70 4600002
     71 ```