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

Home > General
High Scorer (Posted on 2013-05-21) Difficulty: 3 of 5
    
      A     B     C     D     E
   +-----+-----+-----+-----+-----+
   |     |     |     |     |     | 
   |  1  |  7  | 13  | 20  |  6  |
   +-----+-----+-----+-----+-----+
   |     |     |     |     |     | 
   | 25  |  9  |  2  | 23  | 11  |
   +-----+-----+-----+-----+-----+
   |     |     |     |     |     |     
   | 14  | 22  | 17  |  8  | 16  |    
   +-----+-----+-----+-----+-----+
   |     |     |     |     |     |      
   |  4  | 12  | 10  |  3  | 19  |    
   +-----+-----+-----+-----+-----+
   |     |     |     |     |     |      
   | 24  | 18  |  5  | 15  | 21  |  
   +-----+-----+-----+-----+-----+
Add together five different numbers from the grid above to achieve the highest possible total. Starting at column A and working your way across to column E, only one number may be chosen from each column, and no two numbers may be from the same row or diagonal line.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Conflict? | Comment 7 of 11 |
Seems Ady considers that 101 should be the highest score.

Comments made "up the line" indicate that both Ady and I have missed the phrase "diagonal line" and so this result is invalid.

Indeed, the program listing below reports these occurrences with ever increasing totals:

 51            1  9  17  3  21
 61            1  9  17  19  15
 77            1  23  22  10  21
 78            1  23  17  19  18
 83            7  25  17  19  15
 90            7  23  17  19  24
 94            13  25  22  19  15
 101           13  23  22  19  24


OPEN "c:qb64workhighscore.txt" FOR OUTPUT AS #1

DIM a(5)
DIM b(5)
DIM c(5)
DIM d(5)
DIM e(5)
DATA 1,7,13,20,6,25,9,2,23,11,14,22,17,8,16,4,12,10,3,19,24,18,5,15,21
REM read in 5 rows.
FOR a = 1 TO 5
 READ n1
 a(a) = n1
NEXT
FOR b = 1 TO 5
 READ n2
 b(b) = n2
NEXT
FOR c = 1 TO 5
 READ n3
 c(c) = n3
NEXT
FOR d = 1 TO 5
 READ n4
 d(d) = n4
NEXT
FOR e = 1 TO 5
 READ n5
 e(e) = n5
NEXT





tot1 = 0
tot = 0
REM   select one value from each row
REM   and not in the same column
FOR a = 1 TO 5
 IF used(a) = 0 THEN
  used(a) = 1
  n1 = a(a)
  FOR b = 1 TO 5
   IF used(b) = 0 THEN
    used(b) = 1
    n2 = b(b)
    FOR c = 1 TO 5
     IF used(c) = 0 THEN
      used(c) = 1
      n3 = c(c)
      FOR d = 1 TO 5
       IF used(d) = 0 THEN
        used(d) = 1
        n4 = d(d)

        FOR e = 1 TO 5
         IF used(e) = 0 THEN
          used(e) = 1
          n5 = e(e)
          tot = n1 + n2 + n3 + n4 + n5
          IF tot > tot1 THEN
           tot1 = tot


           PRINT tot1, n1; n2; n3; n4; n5
           PRINT #1, tot1, n1; n2; n3; n4; n5
           tot = 0
          END IF
          used(e) = 0
         END IF
        NEXT
        used(d) = 0
       END IF
      NEXT
      used(c) = 0
     END IF
    NEXT
    used(b) = 0
   END IF
  NEXT
  used(a) = 0
 END IF
NEXT
CLOSE 1

Edited on May 22, 2013, 12:08 am
  Posted by brianjn on 2013-05-21 21:38:23

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 (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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