Pro.ID21802 TitleA high-dimensional problem Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21802 AC0 Submit0 Ratio- 时间&空间限制描述As we all know, a point in n-dimensional space can be represented as a vector (x1, x2, ..., xn), where xi is a real number. Given a vector D = (d1, d2, ..., dn), we can generate a series of planes perpendicular to D: each plane satisfies the condition that for any two point on the plane, say A = (a1, a2, ..., an), B = (b1, b2, ..., bn), the inner product of (A - B) and D is zero, ie. (a1 - b1) × d1 + (a2 - b2) × d2 + ... + (an - bn) × dn = 0, and we call D the normal vector of the plane. let A × B denotes the inner product of A and B. Here are n planes in n-dimensional space: S1, S2, ..., Sn with normal vector D1, D2, ..., Dn respectively. And P1, P2, ..., Pn lies on S1, S2,..., Sn respectively. We don't know the coordinates of P1, P2, ..., Pn, but instead we know D1 × P1, D2 × P2, ..., Dn × Pn. Can we find out the point of intersection of S1, S2, ..., Sn ? 输入There will be multiple test cases. Each data set will be formatted according to the following description: 1. A line containing two integers n, m, 3 ≤ n ≤ 100, 1 ≤ m ≤ n, m represents the number of queries to the same D1, D2, ..., Dn. 2. line 1 + i ( 1 ≤ i ≤ n) : n real number denoting the coordinates of Di. 3. line 1 + n + i ( 1 ≤ i ≤ m): n real number denoting D1 × P1, D2 × P2, ..., Dn × Pn. 输出Description As we all know, a point in n-dimensional space can be represented as a vector (x1, x2, ..., xn), where xi is a real number. Given a vector D = (d1, d2, ..., dn), we can generate a series of planes perpendicular to D: each plane satisfies the condition that for any two point on the plane, say A = (a1, a2, ..., an), B = (b1, b2, ..., bn), the inner product of (A - B) and D is zero, ie. (a1 - b1) × d1 + (a2 - b2) × d2 + ... + (an - bn) × dn = 0, and we call D the normal vector of the plane. let A × B denotes the inner product of A and B. Here are n planes in n-dimensional space: S1, S2, ..., Sn with normal vector D1, D2, ..., Dn respectively. And P1, P2, ..., Pn lies on S1, S2,..., Sn respectively. We don't know the coordinates of P1, P2, ..., Pn, but instead we know D1 × P1, D2 × P2, ..., Dn × Pn. Can we find out the point of intersection of S1, S2, ..., Sn ? Input There will be multiple test cases. Each data set will be formatted according to the following description: 1. A line containing two integers n, m, 3 ≤ n ≤ 100, 1 ≤ m ≤ n, m represents the number of queries to the same D1, D2, ..., Dn. 2. line 1 + i ( 1 ≤ i ≤ n) : n real number denoting the coordinates of Di. 3. line 1 + n + i ( 1 ≤ i ≤ m): n real number denoting D1 × P1, D2 × P2, ..., Dn × Pn. Output For each test data, there will be exactly m lines. For each query output a line containing the coordinates of the point of intersetion of S1, S2, ..., Sn. Round all the coordinates to the second digit after the decimal point. You may assume there will always be exactly one such point Sample Input 3 1 Sample Output 1.00 1.00 1.00 Source 样例输入3 1 样例输出1.00 1.00 1.00 作者 |