0075. Two Circles Again
Имя входного файла: | circles2.in |
Имя выходного файла: | circles2.out |
Ограничение по времени: | 1 s |
Ограничение по памяти: | 64 megabytes |
There are two circles lying on the plane. Your task is to find all their common tangents.
Input file
The first line of the input file contains number of test cases K (1 ≤ K ≤ 10000). Each test case consists of two lines: first contains the description of the first circle, and the second one of the second. The description of each circle is written in the form x, y, r (-1000 ≤ x, y ≤ 1000, 0<r ≤ 1000). All numbers are integer.
Output file
The first line of each output block is to contain the number of common tangents n of the circles from the corresponding test case. The next n lines contain tangent descriptions in form a b c. a, b and c are coefficients of ax+by+c=0, where a2+b2=1, a ≥ 0, and if a=0 then b>0. Also the tangents are to be written in ascending lexicographical order. Output blocks are separated by a single blank line. If there is an infinite number of tangents, output a single number -1. Output a, b and c as precisely as you can.
Your answer will be considered correct if absolute or relative error is less than 10-14.
Examples:
circles2.in | circles2.out |
---|---|
1 0 0 1 0 1 1 | 2 1 0 -1.0 1 0 1 |
Источник: Petrozavodsk Winter 2003. Our Special Contest on Geometry, Wednesday, February 05
Автор: Andrew Lopatin, Nick Durov
Обсудить Отправить решение
Версия для печати