CF569A.Music
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.
Unfortunately, internet is not that fast in the city of Ekaterinozavodsk and the song takes a lot of time to download. But Lesha is quite impatient. The song's duration is T seconds. Lesha downloads the first S seconds of the song and plays it. When the playback reaches the point that has not yet been downloaded, Lesha immediately plays the song from the start (the loaded part of the song stays in his phone, and the download is continued from the same place), and it happens until the song is downloaded completely and Lesha listens to it to the end. For q seconds of real time the Internet allows you to download q - 1 seconds of the track.
Tell Lesha, for how many times he will start the song, including the very first start.
小莱沙喜欢用智能手机听音乐。但智能手机内存有限,因此莱沙通过知名社交网络 InTalk 来听他最喜爱的歌曲。
不幸的是,叶卡捷琳诺扎沃茨克市的网络速度并不快,下载一首歌曲需要很长时间。而莱沙又非常没有耐心。歌曲总时长为 T 秒。莱沙先下载歌曲的前 S 秒,然后开始播放。当播放进度到达尚未下载的部分时,莱沙会立即从头开始重播(已下载的部分仍保留在手机中,下载则从当前中断处继续),如此反复,直到整首歌曲完全下载完毕,莱沙才能从头到尾完整听完。在真实时间的 q 秒内,网络仅能下载 q−1 秒的歌曲内容。
请告诉莱沙,他总共需要启动(即开始播放)这首歌多少次(包含第一次启动)。
输入格式
The single line contains three integers T, S, q (2 ≤ q ≤ 104, 1 ≤ S < T ≤ 105).
单行包含三个整数 T、S、q(2 ≤ q ≤ 104,1 ≤ S < T ≤ 105)。
输出格式
Print a single integer — the number of times the song will be restarted.
输出一个整数——歌曲重新开始播放的次数。
输入输出样例
输入#1
5 2 2
输出#1
2
输入#2
5 4 7
输出#2
1
输入#3
6 2 3
输出#3
1
说明/提示
In the first test, the song is played twice faster than it is downloaded, which means that during four first seconds Lesha reaches the moment that has not been downloaded, and starts the song again. After another two seconds, the song is downloaded completely, and thus, Lesha starts the song twice.
In the second test, the song is almost downloaded, and Lesha will start it only once.
In the third sample test the download finishes and Lesha finishes listening at the same moment. Note that song isn't restarted in this case.
在第一个测试用例中,歌曲的播放速度是下载速度的两倍,这意味着在前四秒内,莱沙播放到了尚未下载的部分,因此他重新开始播放歌曲。再过两秒后,歌曲下载完成,因此莱沙共启动了歌曲两次。
在第二个测试用例中,歌曲几乎已全部下载完毕,莱沙仅需启动歌曲一次。
在第三个样例测试中,下载完成的时刻与莱沙听完歌曲的时刻完全相同。注意,在这种情况下歌曲不会被重新启动。
输入解题思路,AI测评打分。不知道怎么写?