[Python] python通过collections解决约瑟夫问题 →→→→→进入此内容的聊天室

来自 , 2019-07-14, 写在 Python, 查看 105 次.
URL http://www.code666.cn/view/7fbe9c04
  1.  #coding = utf8
  2.  import collections
  3.  def ysf(a,b):
  4.      d = collections.deque(xrange(1,a+1))
  5.      while d:
  6.          d.rotate(-b)
  7.          print d.pop()
  8.  if '__main__'==__name__:
  9.      ysf(13,5)

回复 "python通过collections解决约瑟夫问题"

这儿你可以回复上面这条便签

captcha