New Album
Time limit2sMemory limit128 MB
Given song length, CD capacity, and a superstition banning CD track counts divisible by 13, find the minimum number of CDs needed to fit all songs.
- Level
Medium5 of 10
- Topics
- Greedy, Math, Simulation
- Solved
- No attempts yet
Problem
A band is preparing a new album with N songs of equal length. Each song is L seconds long, and one CD can store at most C seconds of audio.
If two or more songs are placed on the same CD, there must be a 1-second pause between each pair of consecutive songs. Therefore, putting x songs on one CD requires x * L + (x - 1) seconds.
Because of a superstition, no CD may contain a number of songs that is divisible by 13. Determine the minimum number of CDs needed to include all N songs.
Input
The first line contains the number of songs N. N is a natural number no greater than 100,000.
The second line contains the length L of each song in seconds.
The third line contains the capacity C of one CD in seconds. C is a natural number no greater than 10,000, and L is a natural number no greater than C.
Output
Print the minimum number of CDs needed to store all songs.
Hint
In the first public test, at most two songs can fit on one CD.