[Solution] Air Blimp CodeChef Solution
Problem
There are cities in a row. The -th city from the left has a sadness of .
In an attempt to reduce the sadness of the cities, you can send blimps from the left of city that move rightwards (i.e, a blimp crosses cities in order)
You are given two integers and . For each blimp sent, you can make one of the following choices:
- Let the blimp fly over every city, in which case the sadness of every city will decrease by , or,
- Choose a city , and shower confetti over city . In this case, the sadness of cities will decrease by , the sadness of city will decrease by , and cities see no change in sadness.
Find the minimum number of blimps needed such that, by making the above choice optimally for each blimp, you can ensure that no city is sad (i.e, in the end every city has sadness ).
Input Format
- The first line of input contains a single integer — the number of test cases. Then the test cases follow.
- The first line of each test case contains three space-separated integers — the size of the array, and the parameters mentioned in the statement.
- The second line of each test case contains space-separated integers , denoting the sadness of the cities.
Output Format
For each test case, output on a new line the minimum number of blimps needed such that no city is sad.
No comments:
Post a Comment