public class Solution {
public string ComplexNumberMultiply(string a, string b) {
var aryA = a.Split('+');
var aryB = b.Split('+'); var shiA = Convert.ToInt32(aryA[]);
var xuA = Convert.ToInt32(aryA[].Substring(, aryA[].Length - )); var shiB = Convert.ToInt32(aryB[]);
var xuB = Convert.ToInt32(aryB[].Substring(, aryB[].Length - )); var shi1 = shiA * shiB;
var shi2 = xuA * xuB * (-);
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的更多相关文章

  1. [Swift]LeetCode537. 复数乘法 | Complex Number Multiplication

    Given two strings representing two complex numbers. You need to return a string representing their m ...

  2. LeetCode 537. 复数乘法(Complex Number Multiplication)

    537. 复数乘法 537. Complex Number Multiplication 题目描述 Given two strings representing two complex numbers ...

随机推荐

  1. Typescript : 遍历Array的方法:for, forEach, every等

    方法一,for…of 这个貌似是最常用的方法,angular 2中HTML语法绑定也是要的这种语法. let someArray = [1, "string", false]; f ...

  2. webdriver常用函数总结

    #1 创建浏览器对象 driver = webdriver.Chrome() #2 设置隐式等待10秒 driver.implicitly_wait(10) #3 最大化浏览器窗口 driver.ma ...

  3. codechef Far Graphs

    codechef Far Graphs https://www.codechef.com/problems/TBGRAPH 题意 : 给一个简单无向图,要求构造一个序列\(a\),长度为\(n\),极 ...

  4. HDU4864 Task

    题意 Today the company has m tasks to complete. The ith task need xi minutes to complete. Meanwhile, t ...

  5. spec.template.spec.initContainers[1].securityContext.privileged: Forbidden: disallowed by policy 问题解决

    主要是执行系统特权应用解决方法: api server   controller-manager 加上  --allow-privileged=true 即可 之后重启服务  

  6. 收藏一下mybatis全局参数配置

    http://blog.csdn.net/shaoduo/article/details/54285981

  7. 微信开发 api 需要 https 服务器

    微信开发 api 需要 https 服务器 先建一个环境,本地的 https 服务器. 以下这篇不错,很完整. https://zhuanlan.zhihu.com/p/23640321

  8. 使用Docker快速搭建ELK环境

    今天由于Win系统的笔记本没带回家,其次Docker在非Linux系统下都需要安装额外的软件去镜像才行 所以感觉没有差别,先直接用Mac搭建一遍呢, 本篇部分命令和配置内容为摘抄 Mac下使用Dock ...

  9. 一些非常好的VC++/MFC开源项目链接

    Introduction List of some of the best Open Source projects written in VC++/MFC. Background Codeproje ...

  10. java代码---------计算器实现

    总结:虽然,没有人会帮你到底,凭什么要对你怜香惜玉 注意实现哪一个运算就把相关代码放在else if这个判断语句里面 package com.rue; import java.awt.BorderLa ...