independence-day-main-war

We always knew they were coming back.
Species on Earth always had faced the problems came from outer space. We call them Alien , but for them they are travellers, who want to expand their territory. 

When we had defeated them years back and sent them back to their World , still with a hope and with new advanced weapons they are heading towards our Earth.

And this threat s not with just one Nation but with our own Earth. So nations of all around our planet has joined to battle with Aliens once again

Strategy of Aliens to attack our planet this time is that their Battle-Ships will surround our planet from different directions and positions. 

NASA has discovered that the formation of Aliens is in such a manner that all their Power-Energy-Sphere will consist to Centre Point of this formation. And we just need to destroy that Power-Energy-Sphere. 

NASA and our planet needs your help to find out the Centre Point so that our future is safe. Please help us :)

Input : First line of input will contain an integer T number of test cases. Each of test case will have following lines of inputs. An integer N number of Battle-Ships. Next N lines will have two floating point values separated by single space denoting (x, y) position of Battle-Ships.

Output :  For each test case print result in new line. Answer should be a floating point value with having two decimals after floating point.

NOTE : Print output in format (a , b) where a,b are position of Centre Point.

Constraints

1 ≤ T ≤ 50

30 ≤ N ≤ 10^4

-inf ≤ x, y ≤ +inf

SAMPLE INPUT
1
10
4.44 -7.32
10.78 4.08
3.69 -2.35
-2.75 0.68
-5.14 -0.77
4.31 0.77
-9.51 -7.57
-4.22 8.92
8.70 6.99
-7.23 9.58

SAMPLE OUTPUT
(0.31 , 1.30)

Explanation

Note : For SampleInput N is taken 10 but constraints is different.

Explanation : When we draw these points on a drawing-board with origin(0, 0) and when we sketch for centre point it will be same as given in SampleOutput.

Source: hackerearth | Difficulty: EASY
Tags: Mathematics


Solutions:
T = int(input())
results = []

for t in range(T):
	N = int(input())
	coords_x = []
	coords_y = []
	for n in range(N):
		x, y = list(map(float, input().split()))
		coords_x.append(x)
		coords_y.append(y)
	X = sum(coords_x) / len(coords_x)
	Y = sum(coords_y) / len(coords_y)
	results.append("(%0.2f , %0.2f)" % (round(X, 2), round(Y, 2)))

for result in results:
	print(result)





def getPrecise(x):
	return sum(x)/len(x)
	
for _ in range(eval(input())):
	x=eval(input())
	xcr,ycr = [],[]
	for _ in range(x):
		x,y = list(map(float,input().split()))
		xcr.append(x)
		ycr.append(y)
	print("("+str(("%.2f"%getPrecise(xcr)))+" , "+str(("%.2f"%getPrecise(ycr)))+")")
		
		


T=int(input().strip())
for i in range(T):
	N=int(input().strip())
	X,Y=[],[]
	for j in range(N):
		x,y=input().strip().split(' ')
		X.append(float(x))
		Y.append(float(y))
	a=sum(X)
	b=sum(Y)
	a=a/float(N)
	b=b/float(N)
	print('(%.2f , %.2f)'%(a,b))


import sys
t=eval(input())
while t>0:
	t=t-1
	n=eval(input())
	s=0.0
	s1=0.0
	for i in range(0,n):
		a,b=list(map(float,input().split()))
		s=s+a
		s1=s1+b
	s=s/n
	s1=s1/n
	s=round(s,2)
	s1=round(s1,2)
	sys.stdout.write('('+str(format(s,'.2f'))+' , '+str(format(s1,'.2f'))+')')
	print('')




import sys
t=eval(input())
while t>0:
	t=t-1
	n=eval(input())
	s=0.0
	s1=0.0
	for i in range(0,n):
		a,b=list(map(float,input().split()))
		s=s+a
		s1=s1+b
	s=s/n
	s1=s1/n
	s=round(s,2)
	s1=round(s1,2)
	sys.stdout.write('('+str(format(s,'.2f'))+' , '+str(format(s1,'.2f'))+')')
	print('')




import sys

L=list(map(float, sys.stdin.read().split()))
ctr=1

for x in range(int(L[0])):
	N=int(L[ctr])
	ctr+=1
	arr=L[ctr:ctr+(2*N)]
	ctr+=(2*N)
	
	resX=sum(arr[::2])
	resY=sum(arr[1::2])
	
	resX/=N
	resY/=N
	
	print("(%.2f , %.2f)" %(resX, resY))


t=int(input())
for p in range(t):
	n=int(input())
	x1=0;y1=0
	#print("edee")
	for z in range(n):
		#print("edewfef")
		x,y=[float(i) for i in input().split()]
		x1+=x;y1+=y;
	#print("edee")
	x1=x1/n;y1=y1/n
	print(('(%.2f , %.2f)'%(x1,y1)))
	#print("edee")