Sicily 1345 Energy Necklace

Source: Internet
Author: User

First to simulate the understanding of the test instructions, and then find the state transfer equation, note the direction ~

1 //Sicily 1345 Energy Necklace2#include <bits/stdc++.h>3 4 using namespacestd;5 6 inta[205];7 intdp[205][205];8 9 intMain ()Ten { One     intN; A      while(Cin >>N) -     { -Memset (DP,0,sizeof(DP)); the          for(intI=0; i<n; i++) -         { -CIN >>A[i]; -A[i+n] =A[i]; +         } -          for(intI=2*n-1; i>=0; i--)  +         {   A              for(intj=i+2; j<2*n; J + +)  at             {   -                  for(intk=i+1; K < J; k++)  -DP[I][J] = max (Dp[i][j], dp[i][k]+dp[k][j]+a[i]*a[j]*a[k]); -             }   -         }  -         intmaxx=0; in          for(intI=0; i<n; i++)  -         {   toMaxx = Max (Maxx, dp[i][i+n]); +         }   -            theprintf"%d\n", Maxx);  *     } $     return 0;Panax Notoginseng}

Sicily 1345 Energy Necklace

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.