VB习题解答有17个人围成一圈(编号0~16),第0号的人开始从1报数,凡报道3的倍数的人离开圈子,人后再数下去。直到最

1个回答

  • Private Sub Command1_Click()

    Cls

    s = "0123456789ABCDEFG"

    y = s: x = s

    Do Until Len(s) = 1

    i = i + 1

    If i Mod 3 = 0 Then s = Replace(s, Mid(y, i, 1), "") '删除报到3的倍数的号

    If i = Len(y) Then y = y & s

    Loop

    For i = 0 To Len(x) - 1

    If s = Mid(x, i + 1, 1) Then Print "原位置编号是" & i

    Next i

    End Sub

    答案是10号,就是一开始报数报11的那个人