21802_Ahigh-dimensionalproble

2022-5-16 18:20| 发布者: Hocassian| 查看: 23| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505861663900-Problem List-采集的数据-后羿采集器.html

Pro.ID

21802

Title

A high-dimensional problem

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21802

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    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 ≤ mn, m represents the number of queries to the same D1, D2, ..., Dn.

    2. line 1 + i ( 1 ≤ in) : n real number denoting the coordinates of Di.

    3. line 1 + n + i ( 1 ≤ im): 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 ≤ mn, m represents the number of queries to the same D1, D2, ..., Dn.

    2. line 1 + i ( 1 ≤ in) : n real number denoting the coordinates of Di.

    3. line 1 + n + i ( 1 ≤ im): 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
    1 0 0
    0 1 0
    0 0 1
    1 1 1

    Sample Output

    1.00 1.00 1.00

    Source

    样例输入

    3 1
    1 0 0
    0 1 0
    0 0 1
    1 1 1

    样例输出

    1.00 1.00 1.00

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部