Express a given date in 2015 in the MM/DD/YY format.
Determine the total number of distinct dates in 2015 such that MM*DD divides 2000 or 2002.
46 divide into 2000; 24 divide into 2002, with 3 dividing into both so 67 divide into one or the other, inclusive:
1 1 2000
1 1 2002
^^^^ both
1 2 2000
1 2 2002
^^^^ both
1 4 2000
1 5 2000
1 7 2002
1 8 2000
1 10 2000
1 11 2002
1 13 2002
1 14 2002
1 16 2000
1 20 2000
1 22 2002
1 25 2000
1 26 2002
2 1 2000
2 1 2002
^^^^ both
2 2 2000
2 4 2000
2 5 2000
2 7 2002
2 8 2000
2 10 2000
2 11 2002
2 13 2002
2 20 2000
2 25 2000
4 1 2000
4 2 2000
4 4 2000
4 5 2000
4 10 2000
4 20 2000
4 25 2000
5 1 2000
5 2 2000
5 4 2000
5 5 2000
5 8 2000
5 10 2000
5 16 2000
5 20 2000
5 25 2000
7 1 2002
7 2 2002
7 11 2002
7 13 2002
7 22 2002
7 26 2002
8 1 2000
8 2 2000
8 5 2000
8 10 2000
8 25 2000
10 1 2000
10 2 2000
10 4 2000
10 5 2000
10 8 2000
10 10 2000
10 20 2000
10 25 2000
11 1 2002
11 2 2002
11 7 2002
11 13 2002
11 14 2002
11 26 2002
46 24 3 67
DefDbl A-Z
Dim crlf$, molen(12)
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
molen(1) = 31
molen(2) = 28
molen(3) = 31
molen(4) = 30
molen(5) = 31
molen(6) = 30
molen(7) = 31
molen(8) = 31
molen(9) = 30
molen(10) = 31
molen(11) = 30
molen(12) = 31
For m = 1 To 12
For d = 1 To molen(m)
pr = m * d
If 2000 Mod pr = 0 Then s1 = s1 + 1: Text1.Text = Text1.Text & m & Str(d) & " 2000" & crlf
If 2002 Mod pr = 0 Then s2 = s2 + 1: Text1.Text = Text1.Text & m & Str(d) & " 2002" & crlf
If 2000 Mod pr = 0 And 2002 Mod pr = 0 Then both = both + 1: Text1.Text = Text1.Text & "^^^^ both" & crlf
If 2000 Mod pr = 0 Or 2002 Mod pr = 0 Then either = either + 1
Next
Next
Text1.Text = Text1.Text & s1 & Str(s2) & " " & Str(both) & Str(either) & crlf
End Sub
|
Posted by Charlie
on 2015-01-29 09:50:44 |