2024-11-16洛谷 P2890 [USACO07OPEN] Cheapest Palindrome G 做题记录我不会区间dp。设\(f_{i,j}\)表示使得区间\([i,j]\)为回文串的最小操作代价,\(cost_{i,j}\)表示字母\(i\)删除/添加的耗费,那么显而易见的,我们有:\(f_{i,j}\to\min(f_{i,j-1}+\min(cost_{s_j,0},cost_{s_j,1}),f_{i+1,j}+\min(cost_{s_i,0},cost_{s_i,1}))\)。当\(s_i