-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBirthday.cpp
More file actions
34 lines (26 loc) · 761 Bytes
/
Birthday.cpp
File metadata and controls
34 lines (26 loc) · 761 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
// https://www.hackerrank.com/challenges/day-of-the-programmer/problem
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'dayOfProgrammer' function below.
#
# The function is expected to return a STRING.
# The function accepts INTEGER year as parameter.
#
def dayOfProgrammer(year):
if (year == 1918):
return '26.09.1918'
elif ((year <= 1917) & (year%4 == 0)) or ((year > 1918) & (year%400 == 0 or ((year%4 == 0) & (year%100 != 0)))):
return '12.09.%s' %year
else:
return '13.09.%s' %year
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
year = int(input().strip())
result = dayOfProgrammer(year)
fptr.write(result + '\n')
fptr.close()