Created
October 1, 2011 20:40
-
-
Save git2samus/1256635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def HS11DIVS(a, b, x, l, r): | |
if a % x: | |
a += x - a % x | |
current, matches = a, 0 | |
while current <= b: | |
current_sum = sum(int(str_digit) for str_digit in str(current)) | |
if l <= current_sum <= r: | |
matches += 1 | |
current += x | |
return matches % 1000000007 | |
if __name__ == '__main__': | |
a, b = (int(i) for i in raw_input().split()) | |
x, l, r = (int(i) for i in raw_input().split()) | |
print HS11DIVS(a, b, x, l, r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment