Thursday, June 14, 2018

QUADAREA - Maximal Quadrilateral Area : Classical

#The solution in Python 3 is as follows:

from math import sqrt
t=int(input())
i=0
while i<t:
    a, b, c, d = map(float, input().split())
    s = (a+b+c+d)/2
    print (round(sqrt(((s-a)*(s-b)*(s-c)*(s-d))),2))     #Brahmagupta's Formula
    i+=1


#Visit this link for details.

#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!