LightOJ 1031

Правка en3, от Z3R0_IQ, 2021-11-05 08:44:23

Please anyone give me some hints for solving this. problem Link : Lightoj 1031: Easy Game

Alice and Bob are playing a two player game. Initially, there are n integer numbers in an array and Alice and Bob get chances to take them alternatively. Each player can take one or more numbers from the left-end or the right-end of the array but cannot take from both ends at one turn. A player can take as many consecutive numbers as he/she wants during his time. The game ends when all numbers are taken from the array.

The point of each player is calculated by the summation of the numbers, which the player has taken. Each player tries to achieve as much points as possible. If both Alice and Bob play optimally and Alice starts the game, then how much more point can Alice get than Bob?

Input Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case contains a blank line and an integer N (1 ≤ N ≤ 100) denoting the size of the array. The next line contains N space separated integers. You may assume that no number will contain more than 4 digits.

Output For each test case, print the case number and the maximum difference Alice will be able to make after playing this game optimally.

Input 2 4 4 -10 -20 7 4 1 2 3 4

Output:

Case 1: 7 Case 2: 10

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Z3R0_IQ 2021-11-05 08:44:23 1 Tiny change: 'easy-game);\n\nAlice ' -> 'easy-game)\n\nAlice '
en2 Английский Z3R0_IQ 2021-11-05 08:43:33 12 Tiny change: 'ome hints or solution for solvi' -> 'ome hints for solvi'
en1 Английский Z3R0_IQ 2021-11-05 08:42:51 1372 Initial revision (published)