Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def digit_sum(number):
- return sum(map(int, list(str(number)))) % 2
- def calculate_little(begin, end):
- result = 0
- for number in range(begin, end + 1):
- if digit_sum(number):
- result += 1
- return result
- result = 0
- begin, end = int(input()), int(input())
- if end - begin < 1000 or True:
- print(calculate_little(begin, end))
- else:
- fill = []
- old_begin, old_end = begin, end
- while begin % 10 != 1:
- fill.append(begin)
- begin += 1
- while end % 10 != 0:
- fill.append(end)
- end -= 1
- print(fill, begin, end)
- print((end - begin) // 2 + sum(map(digit_sum, fill)) + (old_end - old_begin) // 10 % 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement