有没有大神可以帮忙求通项。
3条回答 默认 最新
- benbenli 2021-05-07 02:00关注
N = [1] i = 0 a = 1 print("(", i, ", ", 0, ") =>", N) while i < 5: s = [x + a for x in N] N = N + s print("(", i, ", ", a, ") =>", N) i = i + 1 a = a * 2
只算到了5,可以修改成你要的范围。下面是输出:
( 0 , 0 ) => [1] ( 0 , 1 ) => [1, 2] ( 1 , 2 ) => [1, 2, 3, 4] ( 2 , 4 ) => [1, 2, 3, 4, 5, 6, 7, 8] ( 3 , 8 ) => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] ( 4 , 16 ) => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 乌班图ip地址配置及远程SSH
- ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
- ¥15 PSPICE制作一个加法器
- ¥15 javaweb项目无法正常跳转
- ¥15 VMBox虚拟机无法访问
- ¥15 skd显示找不到头文件
- ¥15 机器视觉中图片中长度与真实长度的关系
- ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
- ¥15 java 的protected权限 ,问题在注释里
- ¥15 这个是哪里有问题啊?