Brain Teaser

I need help with a brain teaser. I know the answer, but I’d like to know the algorithm to achieve it without resorting to brute force–i.e., writing a program :slight_smile: Here goes:

A bank customer (let’s just say it’s a gal) is cashing a check.

The dyslexic teller gives her dollars for cents and cents for dollars.

The customer unwittingly drops a nickel.

When she gets home, she opens her purse and finds that she has exactly twice as much as she was supposed to get.

How much was the check?

The answer is $31.63. But there must be an easier way to solve for the equation than what I used.

Why do you need an “algorithm”, Dude? Just use yer noodle. A couple of minutes’ thought and the answer is obvious.

Why do you need an “algorithm”, Dude? Just use yer noodle. A couple of minutes’ thought and the answer is obvious.

I can’t find a solution to this puzzle that doesn’t involve brute force. It can be started algebraically:

Let c = the number of cents in the check
Let d = the number of dollars

100c + d - 5 = 2(100d + c)
100c + d - 5 = 200d + 2c
98c = 199d + 5

That gives us one equation with two variables, which means there is not a unique mathematical solution. However, we know that c and d must be integers in the range 0 … 99, so with a little experimentation, or a computer program to try all 10,000 possibilities, we can find the solution. Not elegant, but it gets the job done, and I don’t think there’s a better approach for this problem.

c = 63
d = 31

By making a “guess-timate” you can solve it without a program.

It reasonable to assume that:

(d-5) = 2c - 100 (i.e. the dollars made into cents - 5 cents equal the exact same number as the cents doubled. But if the cents are doubled there is at least a 50/50 chance that it will be an amount over 100 hence the - 100 . I can’t think how to prove it, but I bet it can be shown that the cents can never be less than 50 so this becomes not a guesstimate but a fact. If anybody wants to provide that proof feel free, I’ll think about it myself too.)

This gives d + 95 = 2c

which simplifies the equation into:

49(d+95) = 199d + 5

which gives

d=31.

Let me rephrase the guesstimate because it is confusing.

The dollars minus 5 must be equal to the last two digits of the cents time 2.

All that remains is to show that the cents must always be over 50.

Ahhh … I just thought of the proof.

If the cents is less than 50 then

d-5 = 2c

which gives

98(d-5) = 199d + 5

101d= -495

clearly d cannot be negative therefore the cents must have been greater than 50.

You people are giving me a headache…



I am #1. Everyone else is #2 or lower.