Skip to content

Instantly share code, notes, and snippets.

@muthhukumar
Created August 16, 2020 04:54
Show Gist options
  • Save muthhukumar/e7e2169bdbb1734408c4940a41b169af to your computer and use it in GitHub Desktop.
Save muthhukumar/e7e2169bdbb1734408c4940a41b169af to your computer and use it in GitHub Desktop.
from itertools import product
def Perm(num):
return sum([int(i) for i in num])
first, second = map(int, input().split())
rep = int(input())
arr = [str(i) for i in range(first, second + 1)]
total_count = 0
for i in product(arr, repeat=rep):
if Perm(i) % 2 == 0:
total_count += 1
print(total_count % 1000000007)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment