写代码的时候遇到模的问题
class Solution:
def countCompleteDayPairs(self, hours: List[int]) -> int:
ans = 0
t = [0 for _ in range(24)]
for h in hours:
u = (24-h%24)%24
ans += t[u]
t[h%24] += 1
return ans
如果写成 u = (24-h%24) 是不对的,没有考虑h等于0的情况