题解 | #挑7#
挑7
http://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b
list comprehension
while True:
try:
n = int(input())
seven = [i for i in range(1, n+1) if i % 7 == 0 or '7' in str(i)]
print(len(seven))
except:
break
挑7
http://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b
list comprehension
while True:
try:
n = int(input())
seven = [i for i in range(1, n+1) if i % 7 == 0 or '7' in str(i)]
print(len(seven))
except:
break
相关推荐