September 18th - Card Problem, Largest Sum Problem

Go down

September 18th - Card Problem, Largest Sum Problem

Post  Dan on Thu Sep 18, 2008 6:00 pm

Card Problem
Write a program to calculate the number of all possible 5 card playing-card hands (4 suits, 13 values) with no hand being counted more than once (i.e. Jack of Clubs, 4 of Diamonds, 3 of Spades, 2 of Hearts, King of Hearts is the same as 3 of Spades, 2 of Hearts, King of Hearts, Jack of Clubs, 4 of diamonds, so only one of these hands should be counted).

Number of Possible Hands: 2,598,960

Largest Sum Problem
Write an efficient program that given a two dimensional array, n by n big, 1<= n <= 100, finds the largest possible sum of numbers that are "connected" in the array. Two numbers are connected if one of the numbers is in one of the 3 spots directly above the other.
i.e. in the array
2 4 6 13
1 8 3 12
5 9 7 0

The numbers connected to "8" are 2,4, and 6, and the numbers connected to 12 are 6 and 13.

Given the following array:
2 3 4 5
8 2 3 4
4 2 6 1

The program should output 15.

Time Limit: 1 sec

Edit (Eddie): added some constraints
avatar
Dan
Alumni
Alumni

Number of posts : 73
Age : 26
Location : Waterloo, Ontario
Grade : >12
L337ness :
69 / 10069 / 100

Registration date : 2008-08-27

View user profile

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum