Needed this for
battery-shallow-discharge project.
//bug: (10, 6) returns true incorrectly.
bool isOverlap5x(current, last):
if current < last:
return isOverlap5x(last, current)
else if current == last:
return current %5 == 0
return current/5 > last/5
bool is5xoverlap(current, last):
if current < last:
for i = current+1, i <= last, i++:
if i%5 == 0:
return true
else if current > last:
for i = a-1, i >= last, i--:
if i%5 == 0:
return true
if current == last:
if last %5 == 0:
return true
return false
No comments:
Post a Comment