回覆列表
  • 1 # 茶花女稻花梔子花的

    main()

    {

    floatsn=100.0,hn=sn/2;

    intn;

    for(n=2;n

    {

    sn=sn+2*hn;/*第n次落地時共經過的米數*/

    hn=hn/2;/*第n次反跳高度*/

    }

    printf("thetenthis%fmeter\n",hn);

    }

  • 2 # 創業小白1988

    high = 100n = 10high_all = 0 #第n次落地時走過的長度high_each = 0 #每次落地的高度def ball_lands(n): global high_all, high_each, high #小球第一次落地時 if n == 0: high_each = high high_all += high_each #print("1", high_each, high_all) return high_each #從小球第n次落地往前推 high_each = high * (1 / 2) ** n print(u"第%d次小球彈起的高度為:%.2f" %(n, high_each)) high_all += high_each * 2 #print("2", high_each, high_all) ball_lands(n - 1)ball_lands(n)print(u"小球落地%d次,共經過%.2f米。" % (n,high_all))

  • 中秋節和大豐收的關聯?
  • 擼網貸把徵信搞花了怎麼辦?