Hdu-4570-Multi-bit Trie-simple interval DP

Source: Internet
Author: User

Sometimes, if you do not understand the question, you will not be able to answer questions (this is not nonsense ...)

This question is really disgusting. It is very simple and hard to understand !!

Question:

This question is indeed a bit difficult to understand. At least for me, this is the case. So I went to someone else's blog and read the meaning of the question, which is summarized as follows:

A series with the length of n is given, which is divided into several segments with the minimum requirement. Among them, ai is the first in each series, and bi is the length of each segment, l is to divide the series into l segments.

Example: n = 7, A = {1 2 4 4 5 4 3}, divide it into 1 2 4 | 4 5 | 4 | 3, the space used is 1*2 ^ 3 + 4*2 ^ 2 + 4*2 ^ 1 + 3*2 ^ 1 = 38, if it is divided into 1 2 | 4 4 5 | 4 3, the space used is 1*2 ^ 2 + 4*2 ^ 3 + 4*2 ^ 2 = 52, larger than 38.

#include 
 
  #include 
  
   #include 
   
    #include 
    
     #include 
     
      #include 
      
       #include 
       
        #include 
        #include using namespace std;#define maxn 110#define LL __int64LL mp[maxn][maxn];LL a[maxn];LL dos(LL x,LL y){ if(mp[x][y])return mp[x][y]; LL minn=a[x]; for(LL i=x;i<=y;i++)minn=minn*2; if(y-x+1>20) { minn=0; for(LL i=x;i<=y;i++)minn+=a[i]*2; } for(LL i=x;i
         
          

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.