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

Home > Just Math
Compare two problems (Posted on 2013-05-20) Difficulty: 3 of 5
Solve:
ROBOT=40*ONLY

Compare the number of its possible solutions with that of the following problem:
ROBOT:IT=ONLY

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Initially | Comment 2 of 3 |
... I did not fully understand the use of the colon, I've never seen it employed in an equation before.  Even though internet searches suggested division that still didn't get over my nagging thought about ratio.

Robot1 and Robot2 are the outputs of the program and are only sorted at Print to File. The result was that ROBOT=40*ONLY appeared three times on screen and so needed investigation.

"rb" and "ly" are the successful times Robot1 and Robot2 occurred.

I feel that "Compare" and the use of the colon requires some sort of statement like:
While ROBOT:IT=ONLY has 5 solutions the ratio that IT=40 is 1:5.

Robot1
 robot    only rb     r  o  b  o   t  o  n   l  y 
 92720  2318  1     9  2  7  2  0  2  3  1  8
 92720  2318  2     9  2  7  2  0  2  3  1  8
 92720  2318  3     9  2  7  2  0  2  3  1  8
Robot2
ONLY   ROBOT IT ly
 3586  43032  12  1
 1749  61215  35  2
 2754  82620  30  3
 2764  82920  30  4
 2318  92720  40  5

Listing:
OPEN "c:\qb64\work\robot1.txt" FOR OUTPUT AS #1
OPEN "c:\qb64\work\robot2.txt" FOR OUTPUT AS #2

rb = 0
ly = 0


FOR r = 1 TO 9
 IF used(r) = 0 THEN
  used(r) = 1
  FOR o = 1 TO 9
   IF used(o) = 0 THEN
    used(o) = 1
    FOR b = 0 TO 9
     IF used(b) = 0 THEN
      used(b) = 1
      FOR t = 0 TO 9
       IF used(t) = 0 THEN
        used(t) = 1
        FOR n = 0 TO 9
         IF used(n) = 0 THEN
          used(n) = 1
          FOR l = 0 TO 9
           IF used(l) = 0 THEN
            used(l) = 1
            FOR y = 0 TO 9
             IF used(y) = 0 THEN
              used(y) = 1
              FOR i = 1 TO 9
               IF used(i) = 0 THEN
                used(i) = 1

                robot = r * 10000 + o * 1000 + b * 100 + o * 10 + t
                only = o * 1000 + n * 100 + l * 10 + y
                it = i * 10 + t
                IF robot = 40 * only THEN
                 rb = rb + 1
                 PRINT robot; only; rb; r; o; b; o; t; o; n; l; y
                 PRINT #1, robot; only; rb; r; o; b; o; t; o; n; l; y
                END IF
                IF only = robot / it THEN
                 ly = ly + 1
                 PRINT "                             "; only; robot; it; ly
                 PRINT #2, only; robot; it; ly
                END IF
                used(i) = 0
               END IF
              NEXT
              used(y) = 0
             END IF
            NEXT
            used(l) = 0
           END IF
          NEXT
          used(n) = 0
         END IF
        NEXT
        used(t) = 0
       END IF
      NEXT
      used(b) = 0
     END IF
    NEXT
    used(o) = 0
   END IF
  NEXT
  used(r) = 0
 END IF
NEXT


CLOSE 2
CLOSE 1


  Posted by brianjn on 2013-05-21 04:20:04
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 (1)
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