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] integer n

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

Stats:

CreatedFeb 22, 2017
PublishedFeb 22, 2017
Warriors Trained1853
Total Skips83
Total Code Submissions2918
Total Times Completed641
JavaScript Completions193
C# Completions92
PHP Completions80
CoffeeScript Completions11
Python Completions299
Ruby Completions36
Total Stars54
% of votes with a positive feedback rating93% of 139
Total "Very Satisfied" Votes121
Total "Somewhat Satisfied" Votes16
Total "Not Satisfied" Votes2
Total Rank Assessments7
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • smile67 Avatar
  • St3f4n Avatar
  • hobovsky Avatar
  • jebreen Avatar
  • ejini战神 Avatar
  • dfhwze Avatar
  • saudiGuy Avatar
Ad