Troubling Triangles

View as PDF

Submit solution

Points: 7
Time limit: 0.6s
Memory limit: 64M

Problem type

Having covered addition, Xyene's teacher moves on to something much more challenging - analytical geometry. Once again out of his depth, Xyene approaches you for help with his homework.

For today's homework, Xyene has N (1 \le N \le 200) triangles. Each triangle is defined by the points X, Y, Z (0 \le X \le Y \le Z \le 2^{16}). His task is to calculate both the area (A) and perimeter (P) of the triangle XYZ. A difficult task indeed, but thankfully he has you to help! Do Xyene's homework for him so he doesn't have to.

Input Specification

One line containing N, the number of triangles to follow. The next N lines contain 6 integers separated by single spaces: x, y of each X, Y, Z.

Output Specification

N lines, containing A and P to at least 2 decimal places separated by a single space.

Sample Input

1
0 0 0 1 1 1

Sample Output

0.50 3.41

Comments


  • 0
    abemorgan  commented on Jan. 29, 2023, 7:59 a.m.

    Does anyone know why I am getting IR (ValueError) when submitting? It seemed to work fine when calculating the sample answer


  • 0
    georgehtliu  commented on April 27, 2019, 10:28 p.m.

    Can someone please look at my code? I'm not sure why it's wrong.


    • 0
      Zeyu  commented on April 28, 2019, 11:09 a.m. edited

      Precision is an important aspect of this problem, try to keep your values as precise as possible! You're also printing in a strange format, you'll need to print the numbers without scientific notation.


      • 0
        georgehtliu  commented on April 28, 2019, 11:23 p.m.

        Ah thanks. I'm gonna try it using c++ instead.


  • 1
    sankeeth_ganeswaran  commented on April 19, 2019, 7:05 p.m.

    I'm a bit confused, what's wrong with my code?


    • 1
      Dingledooper  commented on April 20, 2019, 10:52 p.m.

      You need to print them separated by a single space.


      • 1
        subscriber  commented on April 23, 2019, 3:42 p.m.

        In addition to the mighty Dingledooper (aka: Jack from Vic Park), a new line is required after each output


      • 1
        sankeeth_ganeswaran  commented on April 21, 2019, 3:12 p.m.

        loool yea i totally forgot that the output should be seperated by spaces. thanks everyone


    • 0
      magicalsoup  commented on April 20, 2019, 9:14 p.m.

      I'm also pretty sure you are supposed to print it to at least 2 decimal places, the way java has decimals is weird, so format it with string.format() or printf()


      • -4
        Overseas  commented on Jan. 6, 2021, 2:42 a.m.

        not at least, should have been precisely 2 decimals.


    • 0
      Rimuru  commented on April 20, 2019, 8:11 p.m.

      I don't think you're using the correct formula to approach this problem.


  • 0
    nickflyers18  commented on March 26, 2018, 6:55 p.m. edited

    What does IR mean?


    • 1
      Roynaruto  commented on March 26, 2018, 7:10 p.m. edit 2

      Your program returned with a nonzero exit code (if you're not using a native language like C++, it crashed). For languages like Python or Java, this will typically be accompanied with the name of the exception your program threw, e.g., NameError or java.lang.NullPointerException, respectively.

      You can check other status codes here.


  • -9
    Kirito  commented on June 4, 2016, 1:45 a.m. edit 2

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 0
      Pleedoh  commented on May 22, 2017, 11:46 p.m.

      I guess so, maybe it means like always in a positive quadrant, the triangle is arranged in the same sort of way on a Cartesian grid?


    • -11
      Itachi  commented on June 4, 2016, 1:52 a.m.

      This comment is hidden due to too much negative feedback. Show it anyway.