每次输⼊两个复数,每个复数均包括由空格分隔的两个浮点数,输⼊第⼀个复数后,键⼊回⻋,然后继续输⼊第⼆个复数。 4 A- T! G0 F5 A" z2 Q" h 输出两个复数,每个复数占⼀⾏;复数是由⼩括号包围的形如 (a+bi) 的格式。注意不能输出全⻆括号。' q I1 M- a: k0 o
样例输⼊; T- l7 k% o9 h% D; I. G7 i
1& B! l+ [3 J$ \/ r' G
2 ' [- `' o) m+ V" R1 y-1.1 2.0/ o8 s/ I. ?& X: z
0 -4.5 " q' ?8 Y$ ? R: N3 `0 k( M o. w样例输出+ C- Z; X0 C0 `5 O
1' C; E$ e8 a, v7 D
2' y- {( b5 {! B {' @2 O
3 $ S2 I s/ a- G7 X! ^' {4 0 E6 T6 @& M# i. x# v: ~4 J2 ~8 w5 $ o7 S, f, \7 _6 E( G) `8 Y( w5 w(-1.1+2i) (0-4.5i) / `* g- z; b, b5 O" v L(-1.1-2.5i)7 j) x, ^& k( N' D
(-1.1+6.5i) 2 K' \. v1 u2 E2 d) ]9 [9 ^(9+4.95i)6 g) D7 h7 J) T$ y5 D8 H
(-0.444444-0.244444i)2 X8 i( I# M) V; q7 Z" M
提示5 o- E' ~% P* R6 n# u/ W- c4 ]
需要注意,复数的四则运算定义如下所示:5 B6 d6 j4 ]. X" E+ t) I7 N7 A1 p
加法法则: ( a + b i ) + ( c + d i ) = ( a + c ) + ( b + d ) i (a + bi) + (c + di) = (a + c) + (b + d)i (a+bi)+(c+di)=(a+c)+(b+d)i
减法法则: ( a + b i ) − ( c + d i ) = ( a − c ) + ( b − d ) i (a + bi) − (c + di) = (a − c) + (b − d)i (a+bi)−(c+di)=(a−c)+(b−d)i
乘法法则: ( a + b i ) × ( c + d i ) = ( a c − b d ) + ( b c + a d ) i (a + bi) × (c + di) = (ac − bd) + (bc + ad)i (a+bi)×(c+di)=(ac−bd)+(bc+ad)i
除法法则: ( a + b i ) ÷ ( c + d i ) = [ ( a c + b d ) / ( c 2 + d 2 ) ] + [ ( b c − a d ) / ( c 2 + d 2 ) ] i (a + bi) ÷ (c + di) = [(ac + bd)/(c^2 + d^2 )] + [(bc − ad)/(c^2 + d^2)]i (a+bi)÷(c+di)=[(ac+bd)/(c2+d2)]+[(bc−ad)/(c2+d2)]i2 a) W* F% S" r" i0 M! K: `* ^