[LintCode] Copy Books 复印书籍

简介:

Given an array A of integer with size of n( means n books and number of pages of each book) and k people to copy the book. You must distribute the continuous id books to one people to copy. (You can give book A[1],A[2] to one people, but you cannot give book A[1], A[3] to one people, because book A[1] and A[3] is not continuous.) Each person have can copy one page per minute. Return the number of smallest minutes need to copy all the books.

Example

Given array A = [3,2,4], k = 2.

Return 5( First person spends 5 minutes to copy book 1 and book 2 and second person spends 4 minutes to copy book 3. )

Challenge 

Could you do this in O(n*k) time ?

本文转自博客园Grandyang的博客,原文链接:复印书籍[LintCode] Copy Books ,如需转载请自行联系原博主。

相关文章
|
2月前
|
C++
C++番外篇——list的实现
C++番外篇——list的实现
19 0
|
6月前
|
C++
【洛谷 P1000】超级玛丽游戏 题解(raw string literal)
这是一个关于使用字符画展示超级玛丽场景的编程题。无需输入,输出为指定的马里奥图案。提供的C++代码直接打印了预设的场景图案。
55 0
|
存储 C++
【PAT甲级 - C++题解】1047 Student List for Course
【PAT甲级 - C++题解】1047 Student List for Course
74 1
|
存储 C++
【PAT甲级 - C++题解】1109 Group Photo
【PAT甲级 - C++题解】1109 Group Photo
68 0
|
存储 C++
【PAT甲级 - C++题解】1039 Course List for Student
【PAT甲级 - C++题解】1039 Course List for Student
67 0
|
存储 C++
【PAT甲级 - C++题解】1083 List Grades
【PAT甲级 - C++题解】1083 List Grades
76 0
|
存储 C++
【PAT甲级 - C++题解】1028 List Sorting
【PAT甲级 - C++题解】1028 List Sorting
77 0