leetcode537

Posted AsenYang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode537相关的知识,希望对你有一定的参考价值。

public class Solution {
    public string ComplexNumberMultiply(string a, string b) {
        var aryA = a.Split(+);
            var aryB = b.Split(+);

            var shiA = Convert.ToInt32(aryA[0]);
            var xuA = Convert.ToInt32(aryA[1].Substring(0, aryA[1].Length - 1));

            var shiB = Convert.ToInt32(aryB[0]);
            var xuB = Convert.ToInt32(aryB[1].Substring(0, aryB[1].Length - 1));

            var shi1 = shiA * shiB;
            var shi2 = xuA * xuB * (-1);
            var shi = shi1 + shi2;

            var xu1 = shiA * xuB;
            var xu2 = xuA * shiB;
            var xu = xu1 + xu2;

            var result = shi + "+" + xu + "i";

            return result;
    }
}

https://leetcode.com/problems/complex-number-multiplication/#/description

以上是关于leetcode537的主要内容,如果未能解决你的问题,请参考以下文章

Leetcode 537

Leetcode537 Complex Number Multiplication Java实现

LeetCode 917. 仅仅反转字母 / 1706. 球会落何处 / 537. 复数乘法

537 Complex Number Multiplication 复数乘法

leetcode_1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_[二维前缀和](代码片段

Leetcode.1024 视频拼接