美文网首页
Tortoise racing

Tortoise racing

作者: Tiny_z | 来源:发表于2018-03-03 09:15 被阅读14次

    龟1 v1
    龟2 v2
    距离 g

    返回 [hour,minute,second]

      function race(v1,v2,g){
        if(v2 > v1) return null;
        let time = g / (v2 - v1);
        return   [Math.floor(time),Math.floor(time*60%60),Math.floor(time*3600%60)]
      }
    
      function race(v1,v2,g){
        if(v2 > v1) return null;
        let time = g / (v2 - v1) * 3600 * 1000;
        return [time.getHours().time.getMinutes(),time.getSeconds()]
      }
    
    
    

    相关文章

      网友评论

          本文标题:Tortoise racing

          本文链接:https://www.haomeiwen.com/subject/fkctfftx.html