All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
Covert Quantity II (Posted on 2013-08-20) Difficulty: 3 of 5
+---------+-------+
| 1 2 5 9 | R     |       
+---------+-------+       
| 1 3 8 9 | R B   |     
+---------+-------+        
| 1 3 5 7 | B B   |        
+---------+-------+     
| 4 3 9 7 | B B   |        
+---------+-------+
Each of the rows in the table given above indicates an attempt to find out the secret number. Each try has, in the column to the right, the letters R and B.

Each R indicates that this number has one digit in common with the secret number, but in a different position.

Each B indicates that this number has one digit in common with the secret number in the same position.

Determine the secret number.

See The Solution Submitted by K Sengupta    
Rating: 2.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 3 |

DATA 1259,r,1389,rb,1357,bb,4397,bb
FOR i = 1 TO 4
  READ n$(i), a$(i)
NEXT
FOR a = 0 TO 9
 ag$ = LTRIM$(STR$(a))
FOR b = 0 TO 9
 ab$ = ag$ + LTRIM$(STR$(b))
FOR c = 0 TO 9
 abc$ = ab$ + LTRIM$(STR$(c))
FOR d = 0 TO 9
 abcd$ = abc$ + LTRIM$(STR$(d))
 good = 1
 FOR i = 1 TO 4
   t$ = abcd$
   resp$ = ""
   FOR p = 1 TO 4
     IF MID$(t$, p, 1) = MID$(n$(i), p, 1) THEN
       resp$ = resp$ + "b": MID$(t$, p, 1) = " "
     END IF
   NEXT p
   FOR p = 1 TO 4
     IF INSTR(n$(i), MID$(t$, p, 1)) > 0 THEN
       resp$ = "r" + resp$
     END IF
   NEXT p
   IF resp$ <> a$(i) THEN good = 0: EXIT FOR
 NEXT
 IF good THEN PRINT a; b; c; d
NEXT
NEXT
NEXT
NEXT

finds

 8  3  2  7

 


  Posted by Charlie on 2013-08-20 14:40:20
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information