编程介的小学生 2017-04-12 15:07 采纳率: 0.2%
浏览 815
已采纳

Little Mammoth

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 mummy said him:

“You are a big boy now, dear, so you may go out of the cave and take a little small walk around. But beware! There is a lot of danger outside. Horrible humans may try to catch you and make a dinner out of you! Do no walk further than r meters away from the cave entrance.”

And the little mammoth made the first step out of the cave. He was a good boy, so he decided not to violate mummy's order. But suddenly 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 while and decided that he would only eat the grass that he can reach not breaking mummy's recommendation.

The field of grass is a rectangle. Find out how much grass can little 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 little mammoth is allowed to walk from it.

Next line contains x1 , y1 , x2 , and y2 --- coordinates of two opposite corners of the grass field. Coordinate system is 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 1000 by 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

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-04-29 15:48
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 安装 opencv4nodejs 报错
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA
  • ¥20 csv格式数据集预处理及模型选择
  • ¥15 部分网页页面无法显示!