Description: game question. Both parties can obtain the sum of the values of several consecutive array elements on either side of the array, but cannot go from both sides at the same time, you can get the header from one side at a time. # include <cstdio> # include <cstring> # include <cstdlib> int N, sum; int arr [110]; int V [110] [110]; int min (int x, int y) {return x> Y? Y: X;} int dp (int x, int y) {If (V [x] [Y]> sum) return V [x] [Y]; int C = 0; For (INT I = x; I <Y; I ++) C = min (C, dp (X, I )); for (INT I = x + 1; I <= y; I ++) C = min (C, dp (I, y )); V [x] [Y] = arr [y]-Arr [x-1]-C; return V [x] [Y];} int main () {// freopen ("a.txt", "r", stdin); While (scanf ("% d", & N )! = EOF) {If (! N) break; arr [0] = 0; For (INT I = 1; I <= N; I ++) {scanf ("% d ", & amp; arr [I]); arr [I] + = arr [I-1];} memset (v,-127, sizeof (V )); sum = V [0] [0]; printf ("% d \ n", 2 * dp (1, N)-Arr [N]);} return 0 ;}