PAT B 1087 how many different values

The code was released, we learn together, help each other
Title:
Here Insert Picture Description
Input Sample:

2017

Sample output:

1480

Code below (Python):

N = int(input())
lst = []
for i in range(1, N+1):
    t1 = i//2
    t2 = i//3
    t3 = i//5
    lst.append(t1+t2+t3)
print(len(list(set(lst))))
Published 65 original articles · won praise 25 · views 1026

Guess you like

Origin blog.csdn.net/chongchujianghu3/article/details/104987344