题目链接
Problem Description
Final Exam is coming! Cuber QQ has now one night to prepare for tomorrow’s exam.
The exam will be a exam of problems sharing altogether m points. Cuber QQ doesn’t know about the exact distribution. Of course, different problems might have different points; in some extreme cases, some problems might worth 0 points, or all m points. Points must be integers; a problem cannot have 0.5 point.
What he knows, is that, these n problems will be about n totally different topics. For example, one could be testing your understanding of Dynamic Programming, another might be about history of China in 19th century. So he has to divide your night to prepare each of these topics separately. Also, if one problem is worth x points in tomorrow’s exam, it takes at least x+1 hours to prepare everything you need for examination. If he spends less than x+1 hours preparing, he shall fail at this problem.
Cuber QQ’s goal, strangely, is not to take as much points as possible, but to solve at least k problems no matter how the examination paper looks like, to get away from his parents’ scoldings. So he wonders how many hours at least he needs to achieve this goal.
Input
The first line of the input is an integer t (1≤t≤20 000), denoting the number of test cases.
Each test case are three space-separated integers n,m,k (0≤m≤109, 1≤k≤n≤109).
Output
For each test case, output the number of hours Cuber QQ needs.
Sample Input
2
1 10 1
10 109 10
Sample Output
11
1100
-
多校自闭,不想学习,写写博客打法时间 -
论如何在一晚上复习1100小时(八月加急名单 -
思路
答案就是
(1+⌊n−k+1m⌋)∗(k−1)+m+1
解释下,我们把题目理解成老师已知你的复习时间,他要如何干掉你?
假设你复习第i题的时间是t,显然他干掉你这题的最佳方法是使这题的分值为t。我们假设对于i>1,我们复习的时间ti>=ti-1。
老师干掉你的最佳方法是从第一题开始的分数mi=ti,直到∑mi=m。
要使我们至少还有k题没被干掉,由于是求复习时间最少,我们假设前n-k题被老师干掉,要使第n-k+1题不被干掉我们显然有i=1∑n−k+1ti>m
为了最小的复习时间显然有
i=1∑n−k+1ti=m+1
而剩下的由于时间成非严格递增,我们最小的花费即tn-k+1
显然,是使tn-k+1最小即可,而易知tmin=1+⌊n−k+1m⌋证明完毕 -
至于某群内某人说是复习(k-1)个tmin,和1个(m+1)完全是扯淡,善意的提醒一下