宏軍的學習筆記
Prefix Sums 練習題的第一題題目是【CountDiv】 Compute number of integers divisible by k in range [a..b].
方法一:使用 math.floor 的簡易方法
def solutionByFloor(A, B, K): return int((math.floor(B / K) - math.floor((A - 1) / K)))
完整練習題 source code 請參閱:github
沒有留言:
張貼留言