command
module
Version:
v0.0.0-...-cc2c25f
Opens a new window with list of versions in this module.
Published: Aug 23, 2019
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
100道门
描述
- 100道门在一排上,全是关闭的
- 每个门都有一个门牌号1-100
- 每访问一次,就改变一次门状态(关的打开,打开的关闭)
- 第1次访问,只访问门牌号是1的倍数的门
- 第2次访问,只访问门牌号是2的倍数的门
- 第3次访问,只访问门牌号是3的倍数的门
- ...
- 第100次访问,只访问门牌号是100的倍数的门
问题
第100次访问后,哪些门是关闭的,哪些门是打开的
解决过程
- 只测试5个门的情况
- 输出改为已打开的门牌号
- 用自定义类型来封装
- 针对扩展,指定哪些方法可以暴露
未优化
可用数学的优化去将两层循环替换层单层循环
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.