RESET

Long version of the problem.

Information about the winner and the solution

Back to the list of problems.

Short Problem Description

This was the 12/96 POTM ... send email to fah@potm.ffast.att.com and ask for all the details on the NEXT POTM ...

The deadline for entering was November 30, 1996

RESET

My car dashboard (and probably yours) has two mile-measuring things on it:

A) an odometer that measures how many miles my car has traveled 
	since it was born;

        [_][_][_][_][_][_]       <-- this is A

B) a "trip" odometer that measures how many miles the car has
	traveled since I last reset it to zero by pushing a button.

              [_][_][_][_]  *    <-- this is B  (* is the reset button!)

   the button works fine ... and resets B to 0000 when I push it.
   (I had it fixed since the original odometer problem in 1993!)

Well, I often look at my dashboard, and the other day it looked like:

          1  2  3  4  5  6           (total miles travelled)
                1  3  6  2  *        (miles since last reset)

The numbers on top  were all different.  I was truly amazed but 
disappointed that those on the bottom were not "7890".  Obviously,
I should have hit the reset button back at 115566 ... but I didn't.

So, when should I NEXT press the reset to make 10 different numbers
appear at the earliest possible time???  When it wasn't obvious
how to figure this out ... I thought this might be worthy of a POTM!

You'll be given a bunch of starting points (A mileages) and asked to
find when to reset to achieve the earlist possible point at which ten
different digits appear on the odometers.

Your C, C++, PERL, JAVA, or SHELL program will read a file of starting
odometer readings and you will output a corresponding set of mileages.