[BOJ 14873] Tale

View as PDF

Submit solution

Points: 1
Time limit: 0.1s
Memory limit: 16M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Every year, in the middle of summer, a short-stature king, called Statu Palmă Barbă Cot, gives a feast in his castle at which all the knights from the Balkan countries are invited. Făt Frumos is one of the guests, and, like a true knight, he rides to the feast on his fairy horse, named Flămânzilă. Horses are forbidden inside the castle, therefore Făt Frumos intends to tie up Flămânzilă to one of the trees nearby, outside the castle. Flămânzilă is very quiet as long as it has something to eat (its favourite grass grows everywhere), but, after it grazes all the reachable grass, it becomes nervous and begins to blow fire, like a dragon. At such a point, Făt Frumos has to leave the feast in order to calm his quadruped companion.</p>

In order to prevent Flămânzilă from causing a fire, Făt Frumos needs to know the area of the figure within which it can move. The figure is shaped by:

  • the tree to which the horse is tied up (a point of integer coordinates Xc, Yc);
  • the length of the rope L (a positive integer);
  • the wall of the castle that the horse cannot jump over (the wall forms a convex polygon with N edges).

Write a program to calculate the area of the figure within which Flămânzilă can move.

입력 형식

The standard input contains, on the first line, three integers X, Y, and L, separated by a space - the coordinates of the tree to which the horse will be tied up and the length of the rope. The second line contains the positive integer N - the number of vertexes in the polygon. N lines follow, each of them containing two integers Xi, Yi (i = 1, ..., N), separated by a space - the vertexes of the polygon, given clockwise.

출력 형식

The standard output will contain a real number with five decimals - the area of the figure within which Flămânzilă can move.</p>

Note: Results will be evaluated with a precision ε = 1.0.

예제 입력 1

3 3 1
4
3 5
6 7
8 5
7 2

예제 출력 1

3.14159

예제 입력 2

5 5 4
4
4 7
7 9
9 7
8 4

예제 출력 2

36.71737

Comments

There are no comments at the moment.