Page **1** of **1**

### 10216 - The Optimal Coffee Shop!!

Posted: **Thu Aug 15, 2002 3:54 pm**

by **Even**

if input like

1 2 3 or 3 4 7 that is a = b = c

what is the output ??

and can anybody give me more examples...thank you

or give me the output for

3

1 2 3

3 4 5

10000 10000 1

Posted: **Sun Sep 01, 2002 9:57 am**

by **wyvmak**

in case you haven't got AC yet.

my output:

3.000 3.000 3.333 -1.000

6.766 6.813 6.918 7.500

10000.866 10000.914 13333.333 15000.000

### ><

Posted: **Mon Sep 02, 2002 5:05 am**

by **Even**

if a,b,c can't form a triangle...should output be

-1.000 -1.000 -1.000 -1.000 ??

and how to find the DM...optimal??

I try to search from I( x, y ) ...

but I don't know if the answer is correct

( through it's correct to the sample above... )

Posted: **Mon Sep 02, 2002 12:53 pm**

by **wyvmak**

DM is called Fermat point, a search engine will tell you about it. one thing, there're two cases for Fermat point. [i'm surprised that Fermat is such a great mathematician]

if a triangle cannot be formed, only circumcentre is -1. other values still can be obtained. i think you would know what should they be.

Posted: **Mon Sep 16, 2002 3:12 pm**

by **Even**

if the input

2

123 112 12

110 100 20

what is the output ?? thank you :p

Posted: **Mon Sep 16, 2002 3:59 pm**

by **Even**

thanks.... I got AC...

and the answer above is

124.000 125.579 156.783 440.617

119.940 121.590 141.678 182.281

Posted: **Wed Feb 01, 2006 11:02 am**

by **arif_pasha**

wyvmak wrote:if a triangle cannot be formed, only circumcentre is -1. other values still can be obtained. i think you would know what should they be.

i dont understand how the distance from the incenter can be measured..

. can anyone provide some testcases? thnx

Posted: **Wed Feb 01, 2006 11:23 am**

by **arif_pasha**

now i understand how can i find the radius of the incircle even if the points are colinear. but still wa..

can someone provide results for the following test cases:

6

1 2 3

5 5 9

100 100 100

10000 10000 1000

1000 1000 2000

10000 5000 5500

my output:

3.000 3.000 3.333 -1.000

9.974 10.381 10.569 17.206

173.205 173.205 173.205 173.205

10853.518 10892.028 13391.331 15018.785

2000.000 2000.000 2000.000 -1.000

10262.391 10940.191 11136.782 25800.942

Posted: **Wed Feb 01, 2006 11:44 am**

by **arif_pasha**

at last.. i got it accepted..

Posted: **Tue Mar 13, 2007 5:38 am**

by **xiaomengxian**

What is the trick? Could you tell me, please?

I tried all the tests above, but still get WA..

Posted: **Wed Apr 25, 2007 3:49 pm**

by **xiaomengxian**

I've made a stupid mistake... Now I get AC

### Degenerate Triangles

Posted: **Tue Jul 10, 2007 9:56 am**

by **baodog**

A note about degenerate triangles:

If a>b+c, how is anything defined? You can place

the vertices arbitrarily ... and it's still not a Triangle as stated.

So -1.000 -1.000 -1.000 -1.000 if a triangle cannot

be formed at all.

Posted: **Tue Sep 11, 2007 1:47 am**

by **Jan**

Well, I was little bit confused for

**arif_pasha**'s cases. However, all of them are not correct I think. Here are the cases.

**Input:**
Code: Select all

```
11
5 5 9
1 2 3
100 100 100
10000 10000 1000
1000 1000 2000
10000 5000 5500
123 112 12
110 100 20
1 2 3
3 4 5
10000 10000 1
```

**Output:**
Code: Select all

```
10.000 10.381 10.569 17.206
3.000 3.000 3.333 -1.000
173.205 173.205 173.205 173.205
10853.518 10892.028 13391.331 15018.785
2000.000 2000.000 2000.000 -1.000
10500.000 10940.191 11136.782 25800.942
124.000 125.579 156.783 440.617
119.940 121.590 141.678 182.281
3.000 3.000 3.333 -1.000
6.766 6.813 6.918 7.500
10000.866 10000.914 13333.333 15000.000
```

Hope these help.