绳子长100厘米,并且以10厘米/秒的速度均匀拉伸(起点固定,终点拉伸)蚂蚁从起点向终点方向爬,相对绳子的速度是1厘米/秒
请问蚂蚁最终能爬到绳子终点吗?
如果能爬到,需要多长时间呢?

解决方案 »

  1.   


    float f_ropeLenth = 100;
    float f_ropeStep = 10;
    float f_antStep = 1;
    int n_Timer;
    int GetTimeToEnd(float antStep,float ropeStep,float ropLenth)
    {
        int Timer = 0;
        float ant = 0;
        float EndPoint;
        while(ant >= ropLenth)
        {
            EndPoint = ropLenth - ant;
            ropLenth += ropeStep;
            ant = (EndPoint/ropLenth)*ropStep + antStep;
            Timer++;
        }
        return Timer;
    }
      

  2.   

    错误
    while(ant<=ropLenth)
      

  3.   

    错误, ant = (ant/ropLenth)*ropStep + antStep;汗,取消解答
      

  4.   

    看了半天,原来答案是错误的阿这个题目特别繁琐,估计少有人能够解算出来。希望CSDN有真正的高手出现。