Codeforces Round #315 (Div. 2) A. Music | 书脊
http://codeforces.com/contest/569/problem/A
比赛的时候还有个解释, 说下载速度是q/q-1, 即 q是 现实时间, q-1就是下载track时间.
http://codeforces.com/contest/569/problem/A
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 - 1seconds of the track.
Tell Lesha, for how many times he will start the song, including the very first start.
题目大意: 下载一个T秒音乐, 当S秒的时候开始播放, 如果播放到没有下载的地方, 就重新播放, 下载速度是q/q-1, 问播放几次能下载完毕.比赛的时候还有个解释, 说下载速度是q/q-1, 即 q是 现实时间, q-1就是下载track时间.
public void solve(int testNumber, InputReader in, OutputWriter out) {
int t = in.readInt();
int s = in.readInt();
int q = in.readInt();
int n = 0;
while ( s < t) {
s *= q;
n++;
}
out.print(n);
}
Read full article from Codeforces Round #315 (Div. 2) A. Music | 书脊