#P2112. 鸿雁传书
鸿雁传书
Description
He wrote words in total. For aesthetics, you must split the words into lines. The relative order of words cannot change. To simplify the problem, ignore spaces between words.
Xiao Hong likes neat letters. Xiao Ming wants to win her heart, so he asks you to write a program to typeset the words so that the variance of the number of letters per line is minimized. Please output the minimum variance.
Input Format
Line : two positive integers .
Line : space-separated words.
Output Format
One line: a decimal number with exactly one digit after the decimal point representing the minimum variance of letters per line.
4 2
xxx xxxxx xxxx xx
(输入的本来是一封情书,被和谐了……)
1.0
Hint
Sample Explanation:
xxx xxxxx
xxxx xx
.
Constraints:
For of the testdata, , .
For all testdata, , , word length .
Translated by ChatGPT 5
京公网安备 11011102002149号