given three points like (1,1),(2,3),(3,6),I want to check if we can draw a circle that goes through all the points , Hope someone can help

# | User | Rating |
---|---|---|

1 | tourist | 3870 |

2 | Benq | 3618 |

3 | Miracle03 | 3453 |

4 | peehs_moorhsum | 3430 |

5 | Radewoosh | 3418 |

6 | Petr | 3408 |

7 | maroonrk | 3387 |

8 | sunset | 3338 |

9 | ko_osaga | 3334 |

9 | jiangly | 3334 |

# | User | Contrib. |
---|---|---|

1 | YouKn0wWho | 214 |

2 | 1-gon | 203 |

3 | Um_nik | 195 |

4 | Errichto | 181 |

5 | awoo | 180 |

6 | tourist | 176 |

6 | sus | 176 |

8 | antontrygubO_o | 173 |

9 | maroonrk | 170 |

10 | -is-this-fft- | 168 |

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/07/2021 13:04:03 (j2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Can you draw triangle with these 3 points?If yes, then I think you can draw a circle too

You are right. You can always draw a circle through a triangle's points (supposing the points are

notcollinear); to be more precise, this circle is called the triangle's circumscribed circle (easy proof).yes I thought that way

You just need to check whether these points are collinear or not. If they are collinear then the given points lie on a straight line. Otherwise you can always draw a circle such that all three points will lie on circle.

if you can show a code that dose that I would apricate it

use this formula to calculate the area of a triangle when coordinates are given

I think formula should be 0.5*abs[(x1 * (y2 — y3) — x2 * (y1 — y3) + x3 * (y1 — y2)].

You have taken abs difference of (y2, y3), (y3, y1), (y1, y2) which will give wrong answer in case of (1, 4), (1, 7) & (1, 4).

These points are collinear.

Yes,I accidentally take mod of all terms.Now It's correct

Instead, we can just check if the lines made by the points have the same slope and this is easier than area calculation.

If given 3 points are non-colinear(All of them don't lie on a single straight line) then there always exist a circle passing those 3 points. And to check if points are colinear or not you can find area of the triangle using these points and check if it's 0 or not. If it's 0 then the points are colinear

you have 3 points (x1, y1), (x2, y2), (x3, y3) and you need to find a point (center of circle) because if all three points lie on circle, the distance from center to them will be equal for all points. so, let's say the center of circle is (x, y) then you just need to solve below two equations.

f(x)=x*(x+1) / 2

thanks for everyone who helped me