Thursday, June 14, 2018

PIR - Pyramids : Classical

#The solution in Python 3 is as follows:

from math import sqrt
t=int(input())
i=0
while i<t:
    A, D, B, E, C, F = map(lambda x: int(x)**2, input().split())
    volume = sqrt((-A*B*C - A*D*E - B*D*F - C*E*F + A*C*D + B*C*D + \
                    A*B*E + B*C*E + B*D*E + C*D*E + A*B*F + A*C*F + \
                    A*D*F + C*D*F + A*E*F + B*E*F - C*C*D - C*D*D - \
                    B*B*E - B*E*E - A*A*F - A*F*F)/144.0)   
    print (round(volume,4))
    i+=1


#Visit Volume of a Pyramid for more info

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