6 kyu
Simple Fun #151: Rocks
80 of 641myjinxin2015
Description:
Task
Vanya gets bored one day and decides to enumerate a large pile of rocks. He first counts the rocks and finds out that he has n
rocks in the pile, then he goes to the store to buy labels for enumeration.
Each of the labels is a digit from 0 to 9 and each of the n
rocks should be assigned a unique number from 1
to n
.
If each label costs $1
, how much money will Vanya spend on this project?
Input/Output
[input]
integern
The number of rocks in the pile.
1 ≤ n ≤ 10^9
[output]
an integer
the cost of the enumeration.
Example
For n = 13
, the result should be 17
.
the numbers from 1 to n are:
1 2 3 4 5 6 7 8 9 10 11 12 13
we need 17 single digit labels:
1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3
each label cost $1, so the output should be 17.
Algorithms
Similar Kata:
Stats:
Created | Feb 22, 2017 |
Published | Feb 22, 2017 |
Warriors Trained | 1853 |
Total Skips | 83 |
Total Code Submissions | 2918 |
Total Times Completed | 641 |
JavaScript Completions | 193 |
C# Completions | 92 |
PHP Completions | 80 |
CoffeeScript Completions | 11 |
Python Completions | 299 |
Ruby Completions | 36 |
Total Stars | 54 |
% of votes with a positive feedback rating | 93% of 139 |
Total "Very Satisfied" Votes | 121 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 7 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |