CF 494 F. Abbreviation(動態規劃)
題目鏈接:【http://codeforces.com/contest/1003/problem/F】
題意:給出一個n字符串,這些字符串按順序組成一個文本,字符串之間用空格隔開,文本的大小是字母+空格的個數。在這個文本中找k(k>=2)個區間,使得這k個區間完全相同,字符串不能分開,然後把每段的字符串變成單個的字符,並去掉中間的空格。可能有多種方案,求文本的最小長度。【表達能力有限,望理解,具體可以看題目】
You are given a text consisting of nn space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the number of letters and spaces in it.
Let‘s denote a segment of words w[i..j]w[i..j] as a sequence of words wi,wi+1,…,wjwi,wi+1,…,wj. Two segments of words w[i1..j1]w[i1..j1] and w[i2..j2]w[i2..j2] are considered equal if j1?i1=j2?i2j1?i1=j2?i2, j1≥i1j1≥i1,