Description
Given lowercase string \ (S, T \) , you can \ (S \) following \ (4 \) modes of operation:
1. Add a character anywhere in consideration of \ (A \)
2. Delete any of a character, a consideration of \ (B \)
3. Alternatively any one character, consideration \ (C \)
4. exchange of two adjacent characters, the cost of \ (D \)
find the \ (S \) becomes \ (t \) minimum cost.
\ (| S |, | t | \ the 4000 \ space 0 \ Lt a, b, c, d \ the 10000 \ space a + b \ 2d \)
Solution
There does not exist a subtask operation ...... 4
only consider the first three operations, then, due to become \ (T \) all strings of a portion of order relative not change, it becomes a universal set of dp question.
Set \ (f (i, j) \) shows a \ (S \) before \ (I \) th character to be \ (T \) before \ (J \) Consideration characters.
Operation. 1: \ (F (I, J) = F (I, J-. 1) + A \)
Operation 2: \ (F (I, J) = F (I-. 1, J) + B \)
Operation 3 : \ (F (I, J) = F (. 1-I, J-. 1) + C \)
Then consider the operation of frenzied \ (4 \) .