前言:这个2B题。谁出的谁自杀去。题目描述和数据还有官方解题报告都对着干。我们这帮做题的情何以堪!?
Description
The big fight between England and Germany was destroyed by the guy called Larrionda. England could have made a tie of 2:2. But that poor guy disqualified Lampard's wonderful goal. The ball passed through the goal line by half a meter, however, Larrionda turned a blind eye to this goal.
As a fan of Three Lion Regimen, silentsky want to develop a system which uses sensors to get the information to check if it scored or not.
The information includes a point as the location of ball, a vector as the velocity and a cuboid as the goal.
译文大意:
三狮军团和德意志战车单挑的时候,裁判拉里昂达2B了。因为拉里昂达的2B,那个完美进球被吹没了,本来有可能打平的比赛变成了日耳曼人屠戮了盎格鲁撒克逊人。
出题的人是个英粉,现在,他想让你编程构建一个系统来确定那个球到底是进还是没进。
所给信息包括,足球起始位置,速度矢量,以及,球门长方体八点。(均为三维坐标)
Input:
The first line gives an integer t (t<=10000) indicating the number of test cases.
For each case:
The first line gives three real numbers x, y , z, indicating a point to represent the ball.
The second line gives three real numbers a, b, c. indicates a vector to represent the velocity.
The following 8 lines give 8 points according the sequence A, B, C, D, E, F, G, H as is shown in the figure.
Absolute value of all real numbers are smaller than 10000.
It is guaranteed that the initial location of the ball is not inside the goal.
译文:
第一行为测试数据组数(小于等于10000的整数)。
第二行是球的坐标。
第三行是速度矢量。
第4~11行是按序给出的A~H八点的坐标。
(以上数据除组数外均为实数)
所有实数的绝对值均小于10000。
确保球的初始位置不在球门内。 (这句话是让无数人WA的关键。实际的测试数据中给出了在球门内的数据。)(怎么说呢。是写解题报告和出题的人没有和写标程测试数据的人统一好意见呢。还是根本就没认真对待出题这种神圣的事情,纯粹2B了呢?!)
(自己建的图,特意下载了个AutoCAD2010.花了一个小时玩明白一点点建了个图)
Output:
if it scored then output “Case X: Stupid Larrionda!!!”.otherwise output “Case X: Intelligent Larrionda!!!”.(X is the case number starting from 1).
(We consider ABCD as the front of the goal and AB,BC,CD,DA as the goalposts. A shoot scores if and only if it passes through the front of the goal and doesn't crash on the goalpost)
译文:如果球进了,我们就输出“Case X: Stupid Larrionda!!!”(第X种情况:愚蠢的拉里昂达!!!)否则就输出 “Case X: Intelligent Larrionda!!!”(第X种情况:聪明的拉里昂达!!!)(X从1开始计数)
(我们认为ABCD为球门,AB、BC、CD、DA为球门框,球进了的意思是,球从球门穿过并且未触碰到球门框。)
(可是扯淡的地方在于,门线竟然被当做了球门,我们很无奈,但是要尊重题意(去你妈的题意),没办法,还是把门线当做了门框。
这道题的关键就在于判断球是否从球门进入,而非从侧面或者背面或者上下面进入。)
(但是因为,球在球门内向球门里射这种情况的存在,使这道经典计算几何练习题变成了ws的扯淡题。下面将提到。)
Sample Input:
1
20 0 5
-10 5 0
10 0 10
10 10 10
10 10 0
10 0 0
0 0 10
0 10 10
0 10 0
0 0 0
(模拟图在上面)
Sample Output:
Case 1: Stupid Larrionda!!!
我的AC source code: