Hidden Number

5

2 votes
Mathematics, Easy, Mathematics, Mathamatics
Problem

You are given an array A of N integers. Now there is another integer X which is unknown but you know its properties. The properties of the unknown number are:

1. It is an integer.

2. If you subtract all the elements of the array A individually from the number X and add all the differences then it adds to 0.

Your goal is to find the number X.

Input
The first line contains an integer T denoting the total number of test cases.
The first line of each test case contains an integer N as input.
Next line of each test case contains N space separated integers.

Output
In the output you need to print the number X if it exists or else you need to print 1

Constraints
1T10
1N105
1A[i]109

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

If you subtract all the integers from 2 the sum of difference is  1+0+(1)=0.

Editor Image

?