HBC237410L1-1ILOVEWIT,语言题Papers题解

凯凯我们等你回来 算法基础篇 35 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Alan has a large number of papers to write. Being a good student majoring in Computer Science, his brain is powerful enough to write at mostmmmpapers at the same time. At any time, Alan can s

Alan has a large number of papers to write. Being a good student majoring in Computer Science, his brain is powerful enough to write at most mmm papers at the same time. At any time, Alan can start to write a new paper if the number of papers he has started but not yet finished is less than mmm. Once he starts to write a new paper in the xxx-th hour, he will use the next aka_kak​ consecutive hours to complete it. In other words, he will finish this new paper in the (x+ak)(x+a_k)(x+ak​)-th hour, where kkk is the number of papers that Alan has started and has not yet finished (doesn't include the new paper) and a0,a1,⋯ ,am−1a_0,a_1, cdots, a_{m-1}a0​,a1​,⋯,am−1​ is a non-decreasing array. For example, if Alan needs to write 555 papers and m=3,a0=2,a1=4,a2=5m=3,a_0=2,a_1=4,a_2=5m=3,a0​=2,a1​=4,a2​=5. Define an array t={t1,t2,⋯ ,tk}t={t_1,t_2,cdots,t_k}t={t1​,t2​,⋯,tk​} as the time when the paper will be completed for the kkk papers he is writing currently. One possible strategy can be described as follows: At first, Alan begins to write 222 papers, so that t={2,4}t={2,4}t={2,4}. At the end of the first hour, Alan begins to write the third paper, so that t={2,4,1+5}t={2,4,1+5}t={2,4,1+5}. At the end of the second hour, Alan finishes his first paper, so ttt becomes {4,6}{4,6}{4,6}. At the same time, he begins to write his fourth paper, so t={4,6,2+5}t={4,6,2+5}t={4,6,2+5}. At the end of the fourth hour, Alan finishes his second paper, so ttt becomes {6,7}{6,7}{6,7}. At the same time, he begins to write his fifth paper, so t={6,7,4+5}t={6,7,4+5}t={6,7,4+5}. At the end of the sixth hour, Alan finishes his third paper, so ttt becomes {7,9}{7,9}{7,9}. At the end of the seventh hour, Alan finishes his fourth paper, so ttt becomes {9}{9}{9}. At the end of the ninth hour, Alan finishes his fifth paper, so ttt becomes {}{}{}. So, it takes 999 hours for Alan to finish all his 555 papers if he takes such action. Doesn't know how many papers he needs to write, Alan will ask you qqq times and each time he will give you a positive integer nnn, which is the number of papers. To finish his homework as fast as possible and then go to play the computer games, Alan wants to know the minimum time he needs. You must tell him how many hours he needs to complete all his papers if his strategy is optimal.

HBC237410L1-1ILOVEWIT,语言题Papers题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC237410L1-1ILOVEWIT 语言题Papers题解