View Single Post
Old 01-03-2005, 09:20 PM   #11
NrmMyth
Hero Gamer

 
Join Date: Jan 2005
Location: ,
Posts: 454
Thumbs down

So here is one good test for all you guys who are bored, or like chalenges.
I am posting this exam so my good friend Unknown Hero (who I know of) can take a little break.

It is called "The Number" (be afraid, be very afraid) and shouldn't be hard.
Here it goes. THE NUMBER

When all natural numbers (1,2,3,4,5), started from 1 to some known N number write in a line one after another
without a space, we get a array of numbers that looks like this:

For N=16 we get { 12345678910111213141516 }.

Write an algorithm/code that will calculate the exact number od digits of that array.

INPUT:
In one and only row there is one number N, 1<=N<=100,000,000.
OUTPUT:
In one and only row on screen you have to write the needed number from the text.

TESTS:
input
5 | 15 | 120
output
5 | 21 | 252

Good luck.
__________________
Never mess with me when I have a cougar, Never!
NrmMyth is offline                         Send a private message to NrmMyth
Reply With Quote