Unable to solve the problem Find Maximal Selection in 3n Numbers

Правка en1, от wish_me, 2017-12-09 17:36:28

Given 3n numbers placed in a circle, you and two of your friends are playing a game. Each time you pick a number first, then the two neighboring numbers of the one you picked are picked by your friends. All the picked numbers are removed from the circle and the left numbers compose a new circle. This game terminates when all the numbers are removed.

Write a program to find the maximum sum of the numbers you picked.

Eg, if nums = {1,2,3}, it returns 3

if nums = {1,2,3,4,5,6}, the first run you choose 6 and your friends choose 5 and 1. then nums = {2,3,4}. The 2nd run you choose 4. Thus, it returns 4+6=10;

Note-The numbers need not to be sorted.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский wish_me 2017-12-09 17:36:28 732 Initial revision (published)