ALCOHOL + ALCOHOL + ... + ALCOHOL = HANGOVER
How many drinks do you need?
Source: rec.puzzles
27 drinks, as
27 * 3451914 = 93201678
ALCOHOL HANGOVER
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr(13) + Chr(10)
' hangoverlc
s$ = "1234567890": hld$ = s
Do
If InStr(s, "0") > 2 Then
hangover = Val(Left(s, 8))
alcohol = 1000000 * Val(Mid(s, 2, 1)) + 100001 * Val(Mid(s, 9, 1)) + 10000 * Val(Mid(s, 10, 1)) + 1010 * Val(Mid(s, 5, 1)) + 100 * Val(Mid(s, 1, 1))
For mult = 2 To 99
If mult * alcohol = hangover Then
Text1.Text = Text1.Text & mult & " * " & alcohol & " = " & hangover & crlf
End If
Next
End If
DoEvents
permute s
Loop Until s = hld
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2018-05-25 16:03:52 |