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 \(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\le t\le 20\ 000)\), denoting the number of test cases.

Each test case are three space-separated integers \(n,m,k (0\le m\le 10^9, 1\le k\le n\le 10^9)\).

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

题意:

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

题解:

思维

如果做不出 \(k\) 题,那么也就是复习时间最少的 \(n − k + 1\) 道题的难度都小于等于复习的时间。因此想要做出 \(k\) 题,只要让复习时间最少的 \(n − k + 1\) 道题的复习时间总和 \(> m\) 即可。

也就是 \(n - k + 1\) 道题的复习时间总和为 \(m + 1\),剩下 \(k - 1\) 道题的复习时间不是最少的 \(k - 1\) 道题即可。

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;
}

HDU 6651 Final Exam (思维)的更多相关文章

  1. HDU 6651 Final Exam

    hdu题面 Time limit 2000 ms Memory limit 524288 kB OS Windows 吐槽 比赛时候晕死了-- 解题思路 先留坑 公式法 https://blog.cs ...

  2. 2019 Multi-University Training Contest 7 Kejin Player Final Exam

    Kejin Player 期望DP 题意: 初始等级为1,每一级有四个参数 r , s , x , a . 每一级有一个概率p=r/s花费a的代价升级到下一级,失败可能会倒退到x级 设从 l 到 r ...

  3. Final Exam Arrangement(ZOJ)

    In Zhejiang University, there are N different courses labeled from 1 to N. Each course has its own t ...

  4. zoj 3721 Final Exam Arrangement【贪心】

    题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3721 来源:http://acm.hust.edu.cn/vjudg ...

  5. 2019HDU多校第七场 HDU6651 Final Exam

    一.题目 Final Exam 二.分析 题目说的比较绕,总之一定要记住,$n$个题目都可以做,至少作对$k$到,但是做题目的人不知道每道题对应的分数. 作为出题人,如果他是田忌,肯定不会去在做题目的 ...

  6. hdu多校第七场 1006(hdu6651) Final Exam 博弈

    题意: 有n道题,这n道题共m分,要求你至少做出k道才能及格,你可以自由安排复习时间,但是只有某道题复习时间严格大于题目分配的分值时这道题才能够被做出来,求最少的,能够保证及格的复习时间.复习时间和分 ...

  7. [2019杭电多校第七场][hdu6651]Final Exam

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6651 题意:n个科目,总共m分,通过一科需要复习花费科目分数+1分钟,在不知道科目分数的情况下,问最少 ...

  8. HDU 6038 Function(思维+寻找循环节)

    http://acm.hdu.edu.cn/showproblem.php?pid=6038 题意:给出两个序列,一个是0~n-1的排列a,另一个是0~m-1的排列b,现在求满足的f的个数. 思路: ...

  9. HDU - 6438(贪心+思维)

    链接:HDU - 6438 题意:给出 n ,表示 n 天.给出 n 个数,a[i] 表示第 i 天,物品的价格是多少.每天可以选择买一个物品,或者卖一个已有物品,也可以什么都不做,问最后最大能赚多少 ...

随机推荐

  1. MySQL-视图上进行增删改查

    https://dev.mysql.com/doc/refman/5.7/en/view-updatability.html https://dev.mysql.com/doc/refman/8.0/ ...

  2. MFC DLL 导出函数的定义方式

    一直在鼓捣DLL,每天的工作都是调试一个一个的DLL,往DLL里面添加自己的代码,但是对于DLL一直不太了解啊!今天一查资料,才发现自己对于DLL编写的一些基本知识也不了解.要学习,这篇文章先总结DL ...

  3. Cocos2d-x在Windows平台环境的搭建

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. windows平台下配置Cocos2d-X引擎所需的压缩文件和可执行文件,如下: 下载链接: adt:    http://tools.a ...

  4. python基础【第八篇】

    day06笔记 1.小数据池 is 与 ==的区别 ​ is :判断两边的内存地址是否相同 ​ ==:判断两边的值是否相同 python中的驻留机制: 数字: -5 ~ 256 字符串: 3.6 乘法 ...

  5. python2和python3中int整型数据的不同之处

    python2中的除法,结果为整型数字(int型),例如 10/5=2,10/3=3,小数位向下取整 python3中的除法,结果为浮点型数字(float型)结果小数位最多保留16位小数

  6. 关于Puppeteer的那些事儿

    最近开始上手一个自动化测试工具Puppeteer,来谈一谈关于它的一些事儿. Puppeteer中文文档:https://zhaoqize.github.io/puppeteer-api-zh_CN/ ...

  7. 2019-5-21-win10-uwp-url-encode

    title author date CreateTime categories win10 uwp url encode lindexi 2019-5-21 9:54:7 +0800 2018-2-1 ...

  8. MySQL源码编译与初始化

    MySQL源码编译与初始化 链接:https://pan.baidu.com/s/1ANGg3Kd_28BzQrA5ya17fQ 提取码:ekpy 复制这段内容后打开百度网盘手机App,操作更方便哦 ...

  9. 利用ARIMA算法建立短期预测模型

    周五福利日活动是电信为回馈老用户而做的活动,其主要回馈老用户的方式是让用户免费领取对应的优惠券,意在提升老用户的忠诚度和活跃度.今日,为保证仓库备货优惠券资源充足,特别是5元话费券等,需要对该类优惠券 ...

  10. Java高并发网络编程(三)NIO

    从Java 1.4开始,Java提供了新的非阻塞IO操作API,用意是替代Java IO和Java Networking相关的API. NIO中有三个核心组件: Buffer缓冲区 Channel通道 ...