CF2166B.Tab Closing
入门
通过率:0%
时间限制:1.50s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You've been staring at your computer screen for too long; it is time to give it a break and go touch some grass.
Your screen is a line of length a, and there are n tabs displayed on it. You want to close all of the tabs by clicking on the x's at their right endpoint.
Every tab is a segment of length len=min(b,ma), where m is the number of remaining tabs. The tabs are always tightly arranged in sequence from the left endpoint of the screen; that is, the x's will be at len,2⋅len,3⋅len,…,m⋅len units away from the left endpoint. Please note that the length of each tab will change as you are closing tabs.
Now your cursor is at the left endpoint of the screen. You wonder what the minimum number of times you need to move the mouse to close all tabs is.
If you have difficulty understanding the statement, you may also refer to your browser tab for a visualization, or click here.
你盯着电脑屏幕太久了,是时候让它休息一下,出去接触一下大自然了。
你的屏幕是一条长度为 a 的线段,上面显示着 n 个标签页。你想通过点击每个标签页右端的“×”来关闭所有标签页。
每个标签页的长度为 len=min(b,ma),其中 m 是当前剩余的标签页数量。标签页始终紧密地从屏幕左端点开始依次排列;也就是说,“×”的位置分别位于距左端点 len,2⋅len,3⋅len,…,m⋅len 单位处。请注意,随着你逐个关闭标签页,每个标签页的长度会发生变化。
此时,你的鼠标光标位于屏幕左端点。你想知道:关闭所有标签页所需的最少鼠标移动次数是多少?
如果你难以理解题意,也可以参考你浏览器中的标签页进行直观感受,或点击此处查看可视化示意图。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤104). The description of the test cases follows.
Each test case is a line of three integers a, b, and n (1≤b≤a≤109, 1≤n≤109).
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤104)。随后是各测试用例的描述。
每个测试用例是一行,包含三个整数 a、b 和 n(1≤b≤a≤109,1≤n≤109)。
输出格式
For each test case, output a single integer — the minimum number of times you need to move the mouse to close all tabs.
对于每个测试用例,输出一个整数——关闭所有标签页所需的最少鼠标移动次数。
输入输出样例
输入#1
12 8 1 6 9 6 2 10 3 1 10 1 10 9 2 1 5 5 6 6 2 7 9 1 9 3 2 6 8 1 7 8 1 9 8 2 4
输出#1
1 2 1 1 1 1 2 1 2 1 2 1
说明/提示
In the first test case, a possible course of action is to move your cursor to 1 and press 6 times.
In the second test case, a possible course of action is to move your cursor to 4.5 and press once, then move it to 6 and press again. It can be proved that the tabs cannot be closed with less than 2 moves.
在第一个测试用例中,一种可行的操作方案是将光标移动到 1 并按压 6 次。
在第二个测试用例中,一种可行的操作方案是先将光标移动到 4.5 并按压一次,再将光标移动到 6 并再次按压。可以证明,无法用少于 2 次操作关闭所有标签页。
输入解题思路,AI测评打分。不知道怎么写?