HDU 6651 Final Exam (思维)

2019 杭电多校 7 1006

题目链接:HDU 6651

比赛链接:2019 Multi-University Training Contest 7

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 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 points, or all points. Points must be integers; a problem cannot have point.

What he knows, is that, these problems will be about 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 points in tomorrow's exam, it takes at least hours to prepare everything you need for examination. If he spends less than 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 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 , denoting the number of test cases.

Each test case are three space-separated integers .

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

Hint

Cuber QQ should solve one problem in sample 1, so he at least prepares 11 hours when the problem one is 10 point.

Cuber QQ should solve all the ten problems in sample 2, so he at least prepares 110 hours for each problem because there may be one problem is 109 point.

Solution

题意:

一次考试共有 道题,总分为 分。每道题的分数不一定,可能是 分,也可能是 分,分数一定是整数。如果一道题分数为 ,那么复习这道题的时间为 ,现在要保证在考试中做出 题,求准备考试的时间最少为多少。

题解:

思维

如果做不出 题,那么也就是复习时间最少的 道题的难度都小于等于复习的时间。因此想要做出 题,只要让复习时间最少的 道题的复习时间总和 即可。

也就是 道题的复习时间总和为 ,剩下 道题的复习时间不是最少的 道题即可。

Code

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
    int T;
    cin >> T;
    while(T--) {
        ll n, m, k;
        scanf("%lld%lld%lld", &n, &m, &k);
        printf("%lld\n", m + 1 + (m / (n - k + 1) + 1) * (k - 1));
    }
    return 0;
}
全部评论

相关推荐

会飞的猿:我看你想进大厂,我给你总结一下学习路线吧,java语言方面常规八股要熟,那些java的集合,重点背hashmap八股吧,jvm类加载机制,运行时分区,垃圾回收算法,垃圾回收器CMS、G1这些,各种乐观锁悲观锁,线程安全,threadlocal这些。在进阶一些的比如jvm参数,内存溢出泄漏排查,jvm调优。我这里说的只是冰山一角,详细八股可以去网上找,这不用去买,都免费资源。mysql、redis可以去看小林coding,我看你简历上写了,你一定要熟,什么底层b+树、索引结构、innodb、mvcc、undo log、redo log、行级锁表级锁,这些东西高频出现,如果面试官问我这些我都能笑出来。消息队列rabbitmq也好kafka也好,学一种就行,什么分区啊副本啊确认机制啊怎么保证不重复消费、怎么保证消息不丢失这些基本的一定要会,进阶一点的比如LEO、高水位线、kafka和rocketmq底层零拷贝的区别等等。计算机网络和操作系统既然你是科班应该理解起来问题不大,去看小林coding这两块吧,深度够了。spring boot的八股好好看看吧,一般字节腾讯不这么问,其他的java大厂挺爱问的,什么循环依赖啥的去网上看看。数据结构的话科班应该问题不大,多去力扣集中突击刷题吧。项目的话其实说白了还是结合八股来,想一想你写的这些技术会给你挖什么坑。除此之外,还有场景题、rpc、设计模式、linux命令、ddd等。不会的就别往简历上写了,虽然技术栈很多的话好看些,但背起来确实累。总结一下,多去实习吧,多跳槽,直到跳到一个不错的中厂做跳板,这是一条可行的进大厂的路线。另外,只想找个小厂的工作的话,没必要全都照这些准备,太累了,重点放在框架的使用和一些基础八股吧。大致路线就这样,没啥太多难度,就是量大,你能达到什么高度取决于你对自己多狠,祝好。
点赞 评论 收藏
分享
我的名字是句号:接好运
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务