Five friends Andy, Brad, Cole, Dan and Enoch went to a supermarket and bought five sets of mobile phones.
- Each of the five friends took precisely one set. However, they chose to use mobile service networks of four service providers P, Q, R or S.
- Mobile phone sets of each person had a unique facility. These facilities were: 4k colour display, Group SMSing, Graphics and Screen savers.
It is known that:
- Amongst, Andy, Brad, Cole, Dan and Enoch two were enjoying services of network P and two were enjoying 4k colour display facilities.
- The one who was enjoying "group SMSing" facility in his mobile phone set, was also enjoying the Q network.
- Neither of the two who were enjoying network P were Andy or Cole. Nor were they enjoying "4k colour display" facility in their mobile phone sets.
- Brad who was not using the network S, was enjoying "4k colour display" facility in his mobile phone set.
- Neither Andy nor Enoch was enjoying "4k colour display" facility or “graphics” facility.
From the above clues, determine which friend used which network and what was the facility provided in his mobile phone set.
In the following seven sets of solutions, each line is in the order Andy, Brad, Cole, Dan and Enoch. The first row indicates the carrier, and the second row the feature, where 1 is 4k color display; 2 is Group SMS, 3 is graphics and 4 is screen saver.
qprps
21314
qprsp
21314
qpspr
21314
qpsrp
21314
qrspp
21314
rpspq
41312
sprpq
41312
DefDbl A-Z
Dim used(4), netw As String, had2
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
netw = "ppqrs": h$ = netw
f$ = Space$(5)
Do
For feata = 1 To 4
used(feata) = 1
Mid(f$, 1, 1) = LTrim(Str(feata))
For featb = 1 To 4
If used(featb) <= 2 And (used(featb) <= 1 Or had2 = 0) Then
used(featb) = used(featb) + 1
If used(featb) > 1 Then had2 = 1
Mid(f$, 2, 1) = LTrim(Str(featb))
For featc = 1 To 4
If used(featc) <= 2 And (used(featc) <= 1 Or had2 = 0) Then
used(featc) = used(featc) + 1
If used(featc) > 1 Then had2 = 1
Mid(f$, 3, 1) = LTrim(Str(featc))
For featd = 1 To 4
If used(featd) <= 2 And (used(featd) <= 1 Or had2 = 0) Then
used(featd) = used(featd) + 1
If used(featd) > 1 Then had2 = 1
Mid(f$, 4, 1) = LTrim(Str(featd))
For feate = 1 To 4
If used(feate) <= 2 And (used(feate) <= 1 Or had2 = 0) Then
used(feate) = used(feate) + 1
If used(feate) > 1 Then had2 = 1
Mid(f$, 5, 1) = LTrim(Str(feate))
good = 1
If used(1) < 2 Then good = 0
If used(2) > 1 Then good = 0
If used(3) > 1 Then good = 0
If used(4) > 1 Then good = 0
ix = InStr(netw, "q")
If Mid(f$, ix, 1) <> "2" Then good = 0
If Mid(netw, 1, 1) = "p" Or Mid(netw, 3, 1) = "p" Then good = 0
If Mid(f$, 1, 1) = "1" Or Mid(f$, 3, 1) = "1" Then good = 0
If Mid(netw, 2, 1) = "s" Or Mid(f$, 2, 1) <> "1" Then good = 0
If Mid(f$, 1, 1) = "1" Or Mid(f$, 5, 1) = "1" Then good = 0
If Mid(f$, 1, 1) = "3" Or Mid(f$, 5, 1) = "3" Then good = 0
If good Then
Text1.Text = Text1.Text & netw & crlf$
Text1.Text = Text1.Text & f$ & crlf$ & crlf$
End If
used(feate) = used(feate) - 1
If used(feate) = 1 Then had2 = 0
End If
Next
used(featd) = used(featd) - 1
If used(featd) = 1 Then had2 = 0
End If
Next
used(featc) = used(featc) - 1
If used(featc) = 1 Then had2 = 0
End If
Next
used(featb) = used(featb) - 1
If used(featb) = 1 Then had2 = 0
End If
Next
used(feata) = 0
Next
permute netw
Loop Until netw = h$
End Sub
|
Posted by Charlie
on 2014-05-05 13:48:11 |