I have been working on noip recently. I have not been able to solve this problem because I am too busy. Ah, ah ......
Clearly, the water is terrible. I made a lesson !! I don't want to engage in oi anymore!
Especially funny !!!!
Code:
# Include <cstdio> # include <cstring> # include <iostream> # include <cstdlib> # include <algorithm> # define n 251 using namespace STD; int N; int a [n] [N]; int Val [N]; int main () {scanf ("% d", & N); memset (A, 0, sizeof (a); For (INT I = 1; I <= N; ++ I) {int X; scanf ("% d", & X ); val [I] = Val [I + N] = x;} For (Int J = 1; j <n; ++ J) for (INT I = 1; I <= 2 * n, I + j <= 2 * n; ++ I) // I must be 2 * n !!!!! For (int K = I; k <I + J; ++ k) A [I] [I + J] = max (A [I] [I + J], A [I] [k] + A [k + 1] [I + J] + val [I] * val [k + 1] * val [I + J + 1] ); int ans = 0; For (INT I = 1; I <= N; ++ I) ans = max (ANS, a [I] [I + n-1]); printf ("% d \ n", ANS); Return 0 ;}
Noip2006t1 energy necklace