Problem H
KTH Challenge Posters

KTH Challenge is back! For this year, Harry and Nils are tasked with hanging up as many posters as possible.
With Harry’s incredible skills of using a single printer to print out posters, and Nils’ incredible skills to hang up posters, they team up and want to put up as many posters as possible within $T$ seconds.
It takes Harry $P$ seconds to print out each poster. After a poster has been printed, Nils can immediately take it and hang it up in $H$ seconds.
We assume that the printer has an infinite supply of paper, and that Harry and Nils can each work independently at the same constant speed without disturbing one another. Additionally, the printer can only print one poster at a time, and Nils can hang up only one poster at a time.
Given that they have $T$ seconds before they have to go home for the day, what is the maximum amount of posters they can put up?
Input
The input consists of a single line with the three integers $P$, $H$, and $T$ ($1 \leq P,H,T \leq 10^9$), which represent the values mentioned in the statement.
Output
Print an integer: the maximum amount of posters Harry and Nils can hang up within $T$ seconds.
Scoring
Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group you need to solve all test cases in the test group.
Group |
Points |
Constraints |
$1$ |
$30$ |
$P,H,T \leq 100$ |
$2$ |
$30$ |
$P > H$ |
$3$ |
$30$ |
$P < H$ |
$4$ |
$10$ |
No additional constraints. |
Sample Input 1 | Sample Output 1 |
---|---|
3 5 8 |
1 |
Sample Input 2 | Sample Output 2 |
---|---|
4 4 17 |
3 |
Sample Input 3 | Sample Output 3 |
---|---|
5 3 14 |
2 |