
106  ZOJ Monthly, May 2011  E
In mathematics, the complex numbers are the extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies: i^{2}=1. Every complex number can be written in the form a + bi or (a, b), where a and b are real numbers called the real part and the imaginary part of the complex number, respectively. The absolute value (or modulus or magnitude) of a complex number x = a + bi is defined as x = sqrt(a^{2} + b^{2}). In linear algebra, functional analysis and related areas of mathematics, a norm is a function that assigns a strictly positive length or size to all vectors in a vector space, other than the zero vector. Pnorm is the most frequently used norm, let p >= 1 be a real number, x = (x_{1} x_{2} ... x_{n})^{T}, x_{p} = (x_{1}^{p} + x_{2}^{p} + ... + x_{n}^{p})^{1/p}. Given two vectors x and y in vector space over complex numbers, you job is to calculate x  y_{p}. Input Two vectors in vector space over complex number. The complexs are in notation (Re,Im), and the vectors are in form "x_{1} x_{2} ... x_{n}" in a seperate line where 1 <= n <= 16 is the dimension of the vector and both a and b in x_{k} = a + bi are in range [16, 16]. Then a real number p specifies which pnorm we will use, p is in range [1, 16]. Each line contains no more than 256 characters, and the blanks only occur between adjacent complexes. Output A number: x  y_{p}. All answers with either an absolute or relative error of less than 1e6 are considered correct. Sample Input (4,0) (0,0) (0,0) (0,3) 2 (1,0) (0,1) (1,0) (0,1) (1,0) (0,1) (1,0) (0,1) 1 (1.4142135623730950488016887242097,1.4142135623730950488016887242097) (0,0) 3.1415926535897932384626433832795 (1,1) (0,0) 2.7182818284590452353602874713527 Sample Output 5 4 2 1.4142135623730950488016887242097 Note Acknowledgements to Wikipedia(http://en.wikipedia.org/wiki/Main_Page), the free encyclopedia, for providing background information. Author: WU, Zejun 