Mailing List Archive: 49091 messages

## [REBOL] Re: OT: Competition - Is this solvable

### From: robert:muench:robertmuench at: 25-Nov-2007 18:25

```
On Fri, 23 Nov 2007 17:57:37 +0100, Sunanda <dhsunanda-gmail.com> wrote:
> No time to write the code (so my hand-waving solution is
> untested), but I'd say:
>
> You are clearly 8800 short of the desired target:

Hi, that's right.

>     t: 41695.83
>     s: 6594,14 + 981,75 + 8747,39 + 1457,90 + 15114,65 + 8800
>     == 41695.83
>
> So, for *minimal* typos, you need to change an 0-->8 or an 1-->9
> in the hundreds column and thousands column of one or two of the
> given numbers. That will affect the minimum digits: ie just two.
>
> There are several ways to do that, easily eyeballable, eg:
>     s: 6594,14 +  981,75 + 8747,39 + 9457,90 + 15914,65 + 0000
>     s: 6594,14 + 8981,75 + 8747,39 + 1457,90 + 15914,65 + 0000

Here is the typo that caused the error:

6594,14+9781,75+8747,39+1457,9+15114,65
ans = 41695,83

9781,75 - 981,75
ans = 8800

It was an additional 7 inserted into the 981,75 value.

> One instance changes two 1's to 9s. The other adds a leading 8 to
> one of the givens.

I think one approach might be to calculate the offset and than look at
each number step by step to see what needs to be changed to get the offset
as difference. The assumption in this case is, that there is only one typo.

> If that had not worked, it gets more interesting: at which point,
> I'm off out :-)

come on ;-)

> But, following Tom's comment, perhaps take a look
> at simetrics.r in the REBOL.org Script library -- it has
> algorithms that can help rate how close strings are to each other.

I thought about this too, but this requires a reference string/sequence
which is not available in our case. Robert
```