Feeling No Pain
Zaux went to the guitar store to buy three items.All three items cost more than $0.99 and less than $9.99.He wanted to find the total cost before he had to pay for them,so he adds them up.Since Zaux took more pain meds today than he should have(on purpose) he multiplys instead of adds.However,he still gets the correct answer.
Given that the total number of cents he spent ended in 7,find the cost of each item.
(there are two solutions)
Given that the total number of cents he spent ended in 7,find the cost of each item.
(there are two solutions)





13 Comments:
I've got
$1, $2.11 and $3.11 = $6.18
$1, $2.09 and $3.03 = $6.12
Process of elimination - which numbers, ending in 7 between 1 cent and 99 cents were not primes - 27 and 77 - and initially assuming at least one purchase value would be $1, worked it out from there.
Then I realised I'd made a mistake when verifying the figures and have started again.
This post has been removed by the author.
$1.00, $1.32 and $7.25 => $9.57
$1.25, $1.62 and $2.80 => $5.67
Method: brute force :(
This post has been removed by the author.
... Zaux multiplied those in his head!!!
This post has been removed by the author.
mmmmmm ... the pain meds must have subdued my craving for musical goodies, because I don't ever remember a trip to the music store where I parted with less than $9.99
wow ... I agree with Chris ... I multiplied those in my head?
This post has been removed by the author.
Here's some faster code, I've deleted the first crude version
Sub sAbc()
'trying to find a+b+c=abc where 9.99 >a,b,c >0.99
'and a*b*c = a+b+c and 100(a+b+c) mod 10 = 7
Dim a, b, c, d As Integer
'optimized for speed
For a = 99 To 999
For b = a To 999
'ensure that only generate sums which = 7 mod 10
d = b + (17 - ((a + 2 * b) Mod 10)) Mod 10
For c = d To 999 Step 10
If a * b * c = 10000 * (a + b + c) Then
Debug.Print "a, b, c, a+b+c, a*b*c =", _
a/100, b/100, c/100,(a+b+c)/100,a*b*c/1000000
End If
Next c
Next b
Next a
Debug.Print "finished"
End Sub
yeah...you got it Chris
your prize is a $0.27 guitar pick
Can I have that at 10%/year for the rest of my life?
Post a Comment
Links to this post:
Create a Link
<< Home