#C7190. Maximum Divisible Value Calculation

    ID: 51034 Type: Default 1000ms 256MiB

Maximum Divisible Value Calculation

Maximum Divisible Value Calculation

You are given an array B of integers. For each element Z in B, your task is to compute the maximum integer W such that
\(Z \mid (W - B[i])\) holds for every \(B[i]\) in B.

It can be mathematically deduced that for a fixed Z, the maximum value W that satisfies \(Z \mid (W - B[i])\) for all \(B[i]\) in B is given by:

[ W = Z + \min(B) ]

Furthermore, given a test case with an integer N and an array B of size N, you need to compute, for each B[i] in B, the value \(W = B[i] + \min(B)\) and output all such computed values for the test case.

inputFormat

The input is read from stdin and has the following format:

  • The first line contains a single integer T denoting the number of test cases.
  • For each test case:
    • The first line contains a single integer N, the number of elements in the array B.
    • The second line contains N space-separated integers representing the array B.

outputFormat

For each test case, output a single line to stdout containing N space-separated integers. Each integer is the result of the computation \(B[i] + \min(B)\) for the corresponding element in B.

## sample
2
2
4 6
3
3 3 3
8 10

6 6 6

</p>