Art, the mail carrier delivers mail to the 19 houses on the east side of a street.
Art notices that:
(i) No two adjacent houses ever get mail on the same day, and:
(ii) There are never more than two houses in a row that get no mail on the same day.
How many distinct patterns of mail delivery are possible?
After listing all the possibilities
Dim crlf$, h(19), ct
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
Text1.Text = Text1.Text & ct & crlf & " done"
For i = 0 To 1
good = 1
h(wh) = i
If h(wh) = 1 And h(wh - 1) = 1 Then good = 0
If wh > 2 Then
If h(wh) + h(wh - 1) + h(wh - 2) = 0 Then good = 0
If good Then
If wh = 19 Then
ct = ct + 1
For j = 1 To 19
Text1.Text = Text1.Text & Str(h(j))
Text1.Text = Text1.Text & crlf
addOn wh + 1
Posted by Charlie
on 2014-09-04 17:33:37