Python小试拿鸡蛋题

2022-11-18 11:46:29 浏览数 (1)

代码语言:javascript复制
z = 0

for i in range(1000):

    if i%1 == 0 and i%2 == 1 and i%3 == 0 and i%4 == 1 and i%5 == 4 and i%6 == 3 and i%7 == 0 and i%8 == 1 and i%9 == 0:

    print(i)  

答案是1449

知乎上有很多解答:https://www.zhihu.com/question/55484566

这其实是一种新的思维方式,遇到新的问题我们可以独立思考,也可以百度,也有人称之为”搜商“,同样也可以有计算思维,就直接让电脑挨个尝试就好了!

0 人点赞