Little Mammoth
Time Limit: 5 Seconds
Memory Limit: 32768 KB Special Judge
It is well known that mammoths used to live in caves. This is a story of a little mammoth who lived in a cave with his mummy and daddy.
The mammoth was little and very cute. And he was very curious.He used to peep out of the cave and look around. And one day mummysaid him:
“You are a big boy now, dear, so you may go out of thecave and take a little small walk around. But beware! There isa lot of danger outside. Horrible humans may try to catch youand make a dinner out of you! Do no walk further than
r metersaway from the cave entrance.”
And the little mammoth made the first step out of the cave. He wasa good boy, so he decided not to violate mummy‘s order. Butsuddenly he saw a nice field of grass around. Nice, green,juicy, tasty grass! How could he stand it!
But no, those dangerous humans. Little mammoth thought for a whileand decided that he would only eat the grass that he can reachnot breaking mummy‘s recommendation.
The field of grass is a rectangle. Find out how much grass canlittle mammoth eat.
Input
There are several test cases in the input. The first line of each case contains
xc , yc and r ---coordinates of the entrance to the cave and the distance littlemammoth is allowed to walk from it.
Next line contains x1 , y1 , x2 , and
y2 --- coordinatesof two opposite corners of the grass field. Coordinate systemis set up in such a way that field‘s sides are parallel to coordinate axes.
All numbers in the input file are integer and do not exceed 1000by their absolute values,
r > 0, both field sides are non-zero.
There is an empty new line between each case.
Output
Output the area of the part of the field where little mammoth can eat grass. Your answer must be accurate up to
10-6.
There should be an empty new line between each case.
Example
Input |
Output |
0 0 5
3 3 7 7
|
0.547426365104
|
模板有bug,找了一天,终于找到了,对三角剖分的理解又深刻了好多。
代码:
/* ***********************************************
Author :_rabbit
Created Time :2014/5/4 15:03:55
File Name :20.cpp
************************************************ */
#pragma comment(linker, "/STACK:102400000,102400000")
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include