Loading...
Loading...
Loading...
A warehouse numbers its days 1, 2, 3, and so on. Every 7th day (7, 14, 21, ...) is a holiday. Given the first day a and the last day b, count the days from a to b, both included, that are not holidays.
Example
Input
5 15
Output
9
Days 5 to 15 are 11 days. Days 7 and 14 are holidays, so 9 remain.
Try the problem first. Open one hint at a time.
Counting day by day is too slow when b is a billion. Count how many multiples of 7 are in the range instead.
Multiples of 7 up to x are x // 7. Subtract the count up to a - 1 from the count up to b.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor