编程介的小学生 2019-07-31 21:51 采纳率: 20.5%
浏览 174

Area K的区域规划问题计算,用C语言

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog