文件名称:yingwenpaiban
介绍说明--下载内容均来自于网络,请自行研究使用
给定一篇包含 N 个单词的诗,每个单词的物理长度依次为 a[0],a[1],...,a[N-1]。欲将诗分成两个段落,每个段落至少有一个单词,每个段落的排版应遵循以下规则:
每行可容纳的总字符数为 M;
每个单词必须在同一行,不得断开换行;
同一行的每两个单词之间有且仅有一个空格,不考虑其他标点符号;
采用左对齐的方式排版,即每行的第一个单词排在该行最左侧;
假设排版之后共有 m 行,每行末端没有英文单词的空档长度记作 s[0],s[1],...,s[m-1]。
不考虑最后一行的空挡大小 s[m-1],设计尽可能高效的算法给文章排版,使得P=s[0]*s[0]+s[1]*s[1]+...+s[m-2]*s[m-2]最小。当 m=1 时, P 等于 0。
假设第一段的最优的 P 值为 P1,第二段的最优的 P 值为 P2,要求令 P1+P2 最小。-Poetry given an N-word contains the physical length of each word in the order of a [0], a [1], ..., a [N-1]. Wishing poem divided into two paragraphs, each have at least one word, each paragraph layout should follow the following rules:
The total number of characters per line that can be accommodated M
Each word must be on the same line, not disconnect wrap
There is only one space, without considering other punctuation between each word the same line
Left-aligned fashion layout, which is the first word of each line in the left-most row of the line
After publishing assume there are m rows, each end of the gap length no English word denoted as s [0], s [1], ..., s [m-1].
The last line is not considered neutral size s [m-1], the design as efficient algorithms to article layout, so P = s [0]* s [0]+ s [1]* s [1]+ ...+ s [m-2]* s [m-2] is minimized. When m = 1, P-equal to zero.
Assume that the first paragraph of the best P value of P1, the second paragraph of the best P value
每行可容纳的总字符数为 M;
每个单词必须在同一行,不得断开换行;
同一行的每两个单词之间有且仅有一个空格,不考虑其他标点符号;
采用左对齐的方式排版,即每行的第一个单词排在该行最左侧;
假设排版之后共有 m 行,每行末端没有英文单词的空档长度记作 s[0],s[1],...,s[m-1]。
不考虑最后一行的空挡大小 s[m-1],设计尽可能高效的算法给文章排版,使得P=s[0]*s[0]+s[1]*s[1]+...+s[m-2]*s[m-2]最小。当 m=1 时, P 等于 0。
假设第一段的最优的 P 值为 P1,第二段的最优的 P 值为 P2,要求令 P1+P2 最小。-Poetry given an N-word contains the physical length of each word in the order of a [0], a [1], ..., a [N-1]. Wishing poem divided into two paragraphs, each have at least one word, each paragraph layout should follow the following rules:
The total number of characters per line that can be accommodated M
Each word must be on the same line, not disconnect wrap
There is only one space, without considering other punctuation between each word the same line
Left-aligned fashion layout, which is the first word of each line in the left-most row of the line
After publishing assume there are m rows, each end of the gap length no English word denoted as s [0], s [1], ..., s [m-1].
The last line is not considered neutral size s [m-1], the design as efficient algorithms to article layout, so P = s [0]* s [0]+ s [1]* s [1]+ ...+ s [m-2]* s [m-2] is minimized. When m = 1, P-equal to zero.
Assume that the first paragraph of the best P value of P1, the second paragraph of the best P value
(系统自动生成,下载前可以参看下载内容)
下载文件列表
英文排版.docx