编程介的小学生 2017-12-07 17:35 采纳率: 20.5%
浏览 931
已采纳

Area K

Problem Description
You, and a group of other scientists, have recently discovered strange gravity anomalies on the planet Alderaan. Further analysis shows that the gravity anomalies are caused by some asteroids floating in orbit. The strange positioning of the asteroids notwithstanding, all scientists except you had decided that this is not a matter worthy of attention and departed to continue research on other places. On the other hand, you believe with pure heart that this is not merely a random event, and landed on the surface of Alderaan to continue your study.
After doing some scanning, you have recorded the positions of all asteroids on your navigation computer as points in a three-dimensional Cartesian system. Interestingly, the data shown by your scanning system indicates that there is some sort of force field around each asteroid – more precisely, the shape of every asteroid’s force field is a regular hexahedron whose every face is perpendicular to one of the axis of the coordinate system, which further confirmed your belief that there is something serious going on here. To find out the source of all these, you have decided to do a series of research on the planet.
The first research you have decided to conduct is to get the area of surface on the ground covered by exactly K asteroids’ force field. For simplicity, you can view the surface of Alderaan as the plane Z = 0.

Input
There are multiple test cases in the input file. Each test case starts with one integer N (1 <= N <= 104), the number of asteroids in orbit. Each of the next N lines consists of four integers X, Y, Z and L (-106<= X, Y <= 106, 0 < Z, L <= 106), describing the position of an asteroid and its edge length of the force field. The asteroid is just at the center of the hexahedron. The last part of each test case consists of one integer K (1 <= K <= N) followed by a blank line, meaning that you need to get the sum of areas on the ground affected by exactly K asteroids’ force fields.
There is a blank line between two successive test cases. A single line with N = 0 indicates the end of input file.

Output
For each test case, output one real number on one separate line, the total area of surface covered by exactly K asteroids, in the format as indicated in the sample output.

Sample Input
2
1 0 1 2
0 1 1 2
1

0

Sample Output
Case 1: 6.000

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-02-26 15:10
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了