简单模拟题.

class Solution:
    def complexNumberMultiply(self, a: str, b: str) -> str:
        a1, a2 = a.split('+')
        b1, b2 = b.split('+')
        a1, a2, b1, b2 = map(int, (a1, a2[:-1], b1, b2[:-1]))
        ans1 = str(a1 * b1 - a2 * b2)
        ans2 = str(b1 * a2 + a1 * b2)
        return ans1 + '+' + ans2 + 'i'

 

相关文章:

  • 2022-12-23
  • 2022-01-02
  • 2022-01-27
  • 2022-01-12
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2022-01-07
  • 2021-04-20
  • 2022-01-27
  • 2022-02-23
  • 2022-12-23
  • 2021-08-07
  • 2021-08-03
相关资源
相似解决方案