题解 | #乘法#

乘法

http://www.nowcoder.com/practice/6429776e4630435cbc3eeb36bdf41f83

function multiply(a, b) {
  function getl(num) {
    const l = num.toString().indexOf('.')
    return l == -1 ? 0 : num.toString().length - l - 1
  }
  return (a*b).toFixed(getl(a) + getl(b))
}
全部评论

相关推荐

明明就不饿:看不懂你到底会啥,什么岗位
点赞 评论 收藏
分享
评论
5
收藏
分享

创作者周榜

更多
正在热议
更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务