#C1986. Minimum Gold Needed for a Journey

    ID: 45251 Type: Default 1000ms 256MiB

Minimum Gold Needed for a Journey

Minimum Gold Needed for a Journey

A merchant is planning a journey to a distant village. Along the route, he must pass through several checkpoints, each guarded by a sentinel demanding a bribe. The amount of gold required at each checkpoint is given as an integer. In order to ensure that he can pay the bribe at every checkpoint, the merchant must carry at least as much gold as the minimum bribe amount among all checkpoints encountered.

Formally, if a journey has \(N\) checkpoints where the bribe amounts are \(a_1, a_2, \ldots, a_N\), then the minimum gold the merchant needs to start with is \(\min(a_1, a_2, \ldots, a_N)\).

inputFormat

The input begins with an integer \(T\) indicating the number of test cases. Each test case is described as follows:

  • The first line contains an integer \(N\), the number of checkpoints.
  • The second line contains \(N\) space-separated integers, where each integer represents the gold required at a checkpoint.

outputFormat

For each test case, output a single line containing the minimum amount of gold required for that journey.

## sample
1
3
10 20 30
10

</p>