-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBeautifullDay
More file actions
43 lines (33 loc) · 915 Bytes
/
BeautifullDay
File metadata and controls
43 lines (33 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'beautifulDays' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER i
# 2. INTEGER j
# 3. INTEGER k
#
def beautifulDays(i, j, k):
# Write your code here
beautifulDays=[]
for start in range(i,j+1):
enddate=int(str(start)[::-1])
#print(start,enddate,start-enddate,(start-enddate)%k)
if (start-enddate)%k == 0:
beautifulDays.append(start)
return len(beautifulDays)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
first_multiple_input = input().rstrip().split()
i = int(first_multiple_input[0])
j = int(first_multiple_input[1])
k = int(first_multiple_input[2])
result = beautifulDays(i, j, k)
fptr.write(str(result) + '\n')
fptr.close()