1 / 4
Feb 2019

#PIR - Pyramids
from math import *
t=int(input())
for t in range(t):

def tetrahedrons(a,b,c,d,e,f):

    a1=(pow(a,2))
    a2=(pow(b,2))
    a3=(pow(c,2))
    a4=(pow(d,2))
    a5=(pow(e,2))
    a6=(pow(f,2))

    a = (4 * (a1 * a2 * a3)
         - a1 * pow((a2 + a3 - a4), 2)
         - a2 * pow((a3 + a1 - a5), 2)
         - a3 * pow((a1 + a2 - a6), 2)
         + (a2 + a3 - a4) * (a3 + a1 - a5)
         * (a1 + a2 - a6))

    #print(a)
    v = sqrt(a)
    v =v/12
    z=(round(v,4))
    #print(end="")
    return z

a,b,c,d,e,f=map(int,input().split())
print(tetrahedrons(a,b,c,d,e,f))

o/p
2
1 1 1 1 1 1
0.1179
1 1 1 1 1 1
0.1179

#why there is a new line ? how to remove it ?
with regards
thank you

  • created

    Feb '19
  • last reply

    Feb '19
  • 3

    replies

  • 1.1k

    views

  • 2

    users

  • 1

    link

10 days later

What new lines?

What you’re seeing is the input and output interleaved. This is because you’re running it interactively, and this isn’t how SPOJ would see it. The SPOJ judge assigns the input file to your program’s input, and an output file to your program’s output - so the input and output are both kept separate.

If you run on Windows, you can do something similar with the command line:

Pir.exe <pir.in >pir.out

Got it

unable to figure out then why WA?

with regards
thank you

1
100 99 98 97 96 95

Expected answer

109082.2996