#C8232. Minimum Moves to Reach Target Position

    ID: 52192 Type: Default 1000ms 256MiB

Minimum Moves to Reach Target Position

Minimum Moves to Reach Target Position

You are given a list of available step sizes and a target position. For each test case, determine the minimum number of moves required to reach or exceed the target position. In each move, you may choose any step size from the list and you can use the same step size repeatedly.

The optimal strategy is to always select the largest available step, denoted as \(\max(step)\). Formally, the answer for each test case is given by:

\[ \text{moves} = \left\lceil \frac{k}{\max(step)} \right\rceil \]

If it is not possible to reach the target (for example, when the list of steps is empty or all steps are 0), output -1.

inputFormat

The input begins with a single integer \(T\) representing the number of test cases. For each test case, the input is given in three lines:

  1. An integer \(n\), the number of available steps.
  2. \(n\) space-separated integers representing the step sizes.
  3. An integer \(k\), the target position.

outputFormat

For each test case, output a single integer denoting the minimum number of moves required to reach or exceed the target position. If the target cannot be reached, output -1.

## sample
1
3
2 3 1
7
3

</p>