思路是a是逐渐增大的一个数,所以只要a发生变化,a的计算结果就一定没出现过,所以count+1. n = int(input()) tem = -1 count = 0 for i in range(1,n+1): a = i//2 + i//3 + i//5 if tem != a: count += 1 tem = a print(count)
1087 有多少不同的值 python
猜你喜欢
转载自blog.csdn.net/weixin_41775301/article/details/87933092
今日推荐
周排行