( Problem D ) Pikachu and Double Team

0

0 votes
Mathematics, Circle, Medium, Geometry
Problem

Pikachu is battling against Meowth in the finals of Orange League. The battle is going to be held on a circular battlefield with centre at point (A,B) and radius R. The Meowth has learnt the move, Double Team. Double team is a move which is used to create illusionary copies of the Pokemon.

Meowth has just used the Double Team and now there are N Meowths which Pikachu has to fight. Pikachu doesn't know the exact position of all the Meowths but he knows that the ith Meowth is somewhere in the circle centred at point (xi,yi) and of radius ri. Pikachu wants to win the battle and thus he wants to use thundershock on the battlefield so that at least one Meowth get damaged. However, he doesn't want to waste much energy, so he will not use thundershock on the whole battlefield, but only in the area where atleast one Meowth can be present. Help Pikachu in calculating the area he will have to cover?

Note that there it is impossible for a Meowth to be out of the battlefield.

Constraints:

  • 1N100
  • 0A,B,xi,yi100
  • 1riR100
  • It is guaranteed that all (xi,yi) are distinct and lie inside the battlefield.

Input format:

  • First line contains 4 integers, N,A,B,R
  • Next N lines contain 3 integers each, ith of which contains xi,yi,ri

Output format:

  • Print a real number, denoting the area Pikachu will have to cover. The solution will be marked correct if the the absolute error or relative error is at most 0.01
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

The blue area, which is union of two green circles, inside the red circle is 33.42.

Editor Image

?