Circles (2) P39799


Statement
 

pdf   zip

html

To solve this exercise you will need the definitions and the procedures of problems P46254 and P84786.

Write a procedure that reads a point:

void read(Point& p);

which is in the input with the two reals x and y in this order.

Write also a procedure that reads a circle:

void read(Circle& c);

which is in the input with the three reals x, y, and radius in this order.

Use all this to write a program that reads a circle c and an initial point p, and moves p according to the input, and prints when p go in or go out of c. Suppose that p will never be exactly in the border of c.

Input

Input starts with a line with the circle c (three reals, the last one strictly positive) and a line with the point p (two reals). Then a natural number n comes followed by n lines, each one with a point that indicates the following move of p.

Output

Your program must print the initial situation of p regard to c, and the moments that the point goes in or goes out of the circle. Follow the format of the examples.

Public test cases
  • Input

    0 0 4.5
    1 1
    5
    10 1
    0 0
    -10 -1
    0.5 0.5
    0 -20
    

    Output

    initially inside
    in the step 1 has gone out
    in the step 3 has gone in
    in the step 5 has gone out
    
  • Input

    5 10 2.5
    2 2
    3
    -1 -1
    -1 -1
    -1 -1
    

    Output

    initially outside
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++