Puzzle

作者: JaedenKil | 来源:发表于2019-06-19 15:30 被阅读0次
"""有15个基督徒和15个非基督徒在海上遇险,为了能让一部分人活下来不得不将其中15个人扔到海里面去,
有个人想了个办法就是大家围成一个圈,由某个人开始从1报数,报到9的人就扔到海里面,
他后面的人接着从1开始报数,报到9的人继续扔到海里面,直到扔掉15个人。
由于上帝的保佑,15个基督徒都幸免于难,
问这些人最开始是怎么站的,哪些位置是基督徒哪些位置是非基督徒。"""
def main():
    persons = [True] * 30
    counter, index, number = 0, 0, 0
    while counter < 15:
        if persons[index]:
            number += 1
            if number == 9:
                persons[index] = False
                counter += 1
                number = 0
        index += 1
        index %= 30
    for person in persons:
        print('基' if person else '非', end='')


if __name__ == '__main__':
    main()

相关文章

  • 2018-07-16

    Amusing Jigsaw Puzzle is funnny puzzle game. PLay it and ...

  • AnimalMosaic

    This is a puzzle puzzle game for children, let children f...

  • 一些诗记录

    The Puzzle You turned and walked awayLeft a puzzle for me...

  • 2018-07-23

    ET Sweet Puzzle Welcome to the ORIGINAL ET Sweet Puzzle a...

  • Puzzle

    最近玩猜谜比较多,谜底首尾相连。如此出题很累,许多尾字不好接的词也被弃用。我和里兄商量,何不像真正的填字游戏那样出...

  • Puzzle

    昨日我们在博雅MBA社群,开启了有史以来不一样的用膳时光。为何这样说?首先是本次都是刘老师和罗汉们亲自下厨,选取...

  • Puzzle

  • Puzzle

    Q1. 717-721-473-217-?-753-576-427-749,问号里的数字是多少呢? Q2. 5+3...

  • PUZZLE

    “游戏?最近工作忙已经很少玩了。”塞巴斯蒂安猛地推开了车门,墨镜青年一不留神脚下没站稳,失去重心后退了几...

  • Puzzle

    Actually I still likes that after running feels,could co...

网友评论

    本文标题:Puzzle

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