-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay of the Programmer
73 lines (41 loc) · 937 Bytes
/
Day of the Programmer
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/python3
import math
import os
import random
import re
import sys
def isleap1(year):
if year % 400==0:
return True
elif year % 4 == 0 and year % 100 != 0:
return True
else :
return False
def isleap2(year):
if year % 4 == 0:
return True
else:
return False
# Complete the dayOfProgrammer function below.
def dayOfProgrammer(year):
if year== 1918:
a=256-230
elif year > 1918:
if isleap1(year):
a=256-244
else:
a=256-243
elif year < 1918:
if isleap2(year):
a=256-244
else:
a=256-243
year1=str(year)
b=str(a)
return b + ".09." + year1
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
year = int(input().strip())
result = dayOfProgrammer(year)
fptr.write(result + '\n')
fptr.close()