HBC216174平方数Fightagainstinvolution题解

痛心疾首 算法基础篇 59 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
n students in this course, and everyone needs to write a final paper. Let. denote the word count of the i-th student's final paper.The grade rule of this course is very amazing. The grade of the i-th student. Every student wants to achieve the highest possible grade, so under the optimal decision. But MianKing found an interesting thing: let's assume that. n. But if everyone only writes 1000 words in their final papers, their grades are still all. n and they can use the time they save to play games.Now to fight against involution, MianKing wants to decide. for each student, and his plan has to satisfy the following conditions:. For each student, his grade cannot be less than that in the original plan.You need help MianKing calculate the minimum value of

MianKing chose a course in this semester. There are n n students in this course, and everyone needs to write a final paper. Let w_i w i ​ denote the word count of the i-th student's final paper. The i-th student has a lower bound L_i L i ​ and an upper bound R_i R i ​ on the number of words in his final paper so that L_ileq w_ileq R_i L i ​ ≤w i ​ ≤R i ​ The grade rule of this course is very amazing. The grade of the i-th student g_i g i ​ is n-K_i n−K i ​ , K_i K i ​ is the number of j in [1,n] j∈[1,n] satisfies that w_j>w_i w j ​ >w i ​ . Every student wants to achieve the highest possible grade, so under the optimal decision w_i w i ​ will equal to R_i R i ​ for the i-th student. But MianKing found an interesting thing: let's assume that forall i in [1,n], L_i=1000,R_i=10000 ∀i∈[1,n],L i ​ =1000,R i ​ =10000. Under the optimal decision w_i w i ​ are all equal to 10000 10000 and the grades of the students are all n n. But if everyone only writes 1000 words in their final papers, their grades are still all n n and they can use the time they save to play games. Now to fight against involution, MianKing wants to decide w_i w i ​ for each student, and his plan has to satisfy the following conditions: For each student, his grade cannot be less than that in the original plan. Minimize the sum of w_i w i ​ . You need help MianKing calculate the minimum value of sum_{i=1}^{n}w_i ∑ i=1 n ​ w i ​

HBC216174平方数Fightagainstinvolution题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC216174平方数Fightagainstinvolution题解