wish_me's blog

By wish_me, history, 15 months ago, In English,

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.

 
 
 
 
  • Vote: I like it  
  • -5
  • Vote: I do not like it