## Troubling Triangles

View as PDF

Points: 7
Time limit: 1.0s
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 () triangles. Each triangle is defined by the points , , (). His task is to calculate both the area () and perimeter () of the triangle . 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 , the number of triangles to follow. The next lines contain 6 integers separated by single spaces: of each .

#### Output Specification

lines, containing and 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

• NightingGale  commented on July 29, 2019, 9:49 p.m.

These triangles are troubling.

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

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

• Zeyu  commented on April 28, 2019, 7: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.

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

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

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

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

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

You need to print them separated by a single space.

• subscriber  commented on April 23, 2019, 11:42 a.m.

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

• sankeeth_ganeswaran  commented on April 21, 2019, 11:12 a.m.

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

• magicalsoup  commented on April 20, 2019, 5: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()

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

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

• silentes  commented on Dec. 12, 2018, 4:33 p.m. edited

Can someone look at my solution? what is the 'value error'

• Roynaruto  commented on March 26, 2018, 3:10 p.m. edited

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.

Edit: I forgot to press the reply button. ;-;

• nickflyers18  commented on March 26, 2018, 2:55 p.m.

What does IR mean?

• TimothyW553  commented on March 26, 2018, 6:53 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• Kirito  commented on June 3, 2016, 9:45 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• Pleedoh  commented on May 22, 2017, 7: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?

• Itachi  commented on June 3, 2016, 9:52 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• bobhob314  commented on Jan. 4, 2015, 7:18 p.m.