F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

A high-dimensional problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 447    Accepted Submission(s): 94


Problem 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 * D2, ..., 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 1 0 0 0 1 0 0 0 1 1 1 1
 

Sample Output
1.00 1.00 1.00
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-19 19:09:03, Gzip enabled