ECLIPSE - Eclipse
Every so often we hear on the news that there is going to be either a solar or lunar eclipse. Eclipses have a long history dating back well into the BC’s. Astronomers study total solar eclipses very closely as they provide the rare opportunity to observe the corona.
An eclipse occurs when two celestial bodies and a star are (nearly) linearly aligned and the shadow cast by the one body intersects the other body, creating darkness on the latter body.
We are interested in determining when a solar eclipse will next occur. In Figure 1 you can see two labelled regions. The umbra is the area of total darkness — a body in this region will experience a total solar eclipse. The penumbra is the area of partial darkness — a body in this region will experience a partial solar eclipse.
You will be given the size and location of a star and two celestial bodies. Your task is to determine if the first celestial body creates a solar eclipse on the second celestial body. If it does then you are to determine whether it is a total or partial eclipse and whether the entire body is in eclipse. If part of the body is experiencing total eclipse while the entire body is experiencing at least a partial eclipse, we are only interested in the part that is in total eclipse.
Consider a scaled model of our solar system with the sun at the origin (0, 0, 0) with radius 700, the moon at position (49900, 1000, 149700) with radius 2 and Earth at position (50000, 1000, 150000) with radius 7. In Figure 1, the sun would be the star on the left and the moon would be the smaller body on the right. Part of Earth would then fall in the black umbra region and hence partly experience a total solar eclipse.
For any body:
- 1 ≤ r ≤ 106
- 0 ≤ x, y, z ≤ 109
It is guaranteed that any two bodies will be at least 1 unit apart, and that moving any one of the bodies by 1 unit (in any direction) will not change the answer.
Input
A test case is described by three lines, each describing the size and location of a single body. The first line contains four space-separated integers xs, ys, zs and rs , describing the center (xs, ys, zs) and radius rs of the star. The following two lines define the two celestial bodies in the same manner.
Test cases follow directly after one another with a −1 representing the end of the test cases.
Output
Each test case has a single line of output describing the type of eclipse for that case. If the second celestial body listed in the test case is experiencing an eclipse, then one of the following lines must be output:
- Entire total solar eclipse
- Part total solar eclipse
- Entire partial solar eclipse
- Part partial solar eclipse
If there is no solar eclipse, the line “No solar eclipse” must be output.
Example
Input: 0 0 0 700 49900 1000 149700 2 50000 1000 150000 7 0 0 0 10 50 0 100 40 60 0 200 1 -1 Output: Part total solar eclipse Entire total solar eclipse
hide comments
[Rampage] Blue.Mary:
2022-09-01 10:46:23
No need to use integer arithmetic. C++ double type (with error bound 1e-10) is enough for solving this problem. |
|
Branfili:
2016-05-04 19:27:52
What about antumbra (after the lines of umbra intersect)?
|
|
Amaterasu:
2016-05-03 23:34:36
"It is guaranteed that any two bodies will be at least 1 unit apart..." does this mean that their centers will be at least 1 unit appart, or distance between 2 centers will be at least sum of their radius + 1(i.e. they will not intersect)? |
|
:D:
2012-04-21 22:59:37
Finally done it. Problem seems to require integer arithmetics to get AC. |
|
LeppyR64:
2010-12-02 02:40:54
total solar eclipse = planet at least partially in umbra
|
|
zetro:
2010-11-27 02:53:11
i get it..
|
|
Marco Gallotta:
2009-06-30 12:24:01
Alex: in such a case your program should output "Part total". |
|
alind:
2009-06-08 15:30:45
"If part of the body is experiencing total eclipse while the entire body is experiencing at least a partial eclipse, we are only interested in the part that is in total eclipse. "
|
Added by: | Marco Gallotta |
Date: | 2008-08-27 |
Time limit: | 30s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | ACM Southern African Regionals 2007 |