Hdu 3613 Best Reward

Source: Internet
Author: User

Question:

Link: Best Reward

Question:

The essence of the question is to give you the character array v, string s, string by .... z, v [0] is the value of a, and so on, (must be divided) divides s into two strings, if the value of a text return is the sum of v [I], the value is 0 instead of a text return. Find the maximum value.

Algorithm:

EKMP algorithm. EMP algorithm details: Click to open the link

Ideas:

...........

Code:

# Include
 
  
# Include
  
   
# Include
   
    
Using namespace std; char s1 [500010], s2 [500010]; int sum [500010], next [500010]; int v [30]; int extend1 [500010], extend2 [500010]; void EKMP (char s [], char t [], int next [], int extend []) // evaluate the template of the extend Array {int I, j, p, l; int len = strlen (t); int len1 = strlen (s); memset (next, 0, sizeof (next); memset (extend, 0, sizeof (extend); next [0] = len; j = 0; while (1 + j
    
     
> T; while (t --) {for (int I = 0; I <26; I ++) cin> v [I]; getchar (); gets (s1); int len = strlen (s1); sum [0] = 0; for (int I = 0; I
     
      
> 30; for (int I = 1; I
      
        Ans) ans = temp;} cout <
       



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.