Express a given date in 2015 in the MM/DD/YY format.
Determine the total number of distinct values of MM*DD in the year 2015.
(In reply to
computer solution by Charlie)
Some numbers were counted that shouldn't have been counted, like 2*31 = 62 or 11*30 = 330.
The answer is actually 178.
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
For m = 1 To 12
Select Case m
Case 1, 3, 5, 7, 8, 10, 12
fin = 31
Case 2
fin = 28
Case Else
fin = 30
End Select
For d = 1 To fin
If prod(m * d) = 0 Then ct = ct + 1
prod(m * d) = 1
Next
Next
Text1.Text = Text1.Text & ct & crlf
End Sub
|
Posted by Charlie
on 2015-02-18 19:43:50 |