Description
An undergraduate student, realizing, and needs to does, improve his chances of the being to accepted graduate OL, decided that it's now time to do some independent. Of course, he has decided-do-do-in-most important-domain:the requirements He-must fulfill to-graduate from H is undergraduate University. In the surprise, he discovered the he has to fulfill 5 distinct Requirements:the General Institute requirement, The writing requirement, the science requirement, the foreign-language requirement, and the Field-of-specialization Requir Ement. Formally, a requirement is a fixed number of the classes that him has to take during his undergraduate. Thus, for example, the foreign language requirement specifies and the student has to take 4 classes to fulfill this Requi Rement:french I, French II, French III, and French Iv. Having analyzed the immense multitude of the classes which need to is taken to fulfill the different, our requirements ENT beCame a little depressed about his undergraduate university:there are so many classes to take ...
Dejected, the student began studying the requirements of other universities, and he might have after the high chosen. He found which, in fact, and other universities had exactly the same 5 requirements as his own. The only difference is this different universities had different number of classes to is satisfied in each of the five re Quirement.
Still, it appeared that universities have pretty similar requirements (all of them require a lot of classes), so he Hypoth Esized that no two universities are very dissimilar in their requirements. He defined the dissimilarity of two universities X and Y as |x1−y1| + |x2−y2| + |x3−y3| + |x4−y4| + |x5−y5|, where a XI (yi) is the number of classes in the requirement I of university X (Y) multiplied by a Appropria Te factor that measures hardness to the corresponding requirement at the corresponding university.
Input
The ' the ' input file contains an integer N (1≤n≤100), the number of considered universities. The following N lines each describe the requirements of a university. A University X is described by the five non-negative real numbers x1 x2 x3 x4.
Output
On a single line, print the dissimilarity value of the two most dissimilar universities. Your answer should is rounded to exactly two decimal places.
Sample Input
3
2 5 6 2 1.5
1.2 3 2 5 4 7 5 3 2 5
Sample Output
12.80
the
The coordinates of N points in five-D space are given, and the maximum Manhattan distance of two points is obtained.
train of Thought
We can define the official meaning of the Manhattan distance as l1-distance or city block distance , which is the sum of the distance between the projection of the axis produced by two points in the fixed rectangular coordinate system of Euclidean space.
For example, on the plane, the coordinates (X1,Y1) (x_1,y_1) point P1 p_1 with the coordinates (X2,Y2) (x_2,y_2) point P2 the Manhattan distance is: p_2 |x1−x2|+|y1−y2|
In a two-dimensional plane, the two-point coordinate (A1,B1) (A2,B2) (a_1,b_1) ~ (a_2,b_2) with the farthest distance is the Manhattan distance: |a1−a2|+|b1−b2| |a_1-a_2|+|b_1-b_2|
There are four ways to remove absolute value: (A1−A2) + (B1−B2) (a_1-a_2) + (b_1-b_2) (A1−A2) + (