Skip to content

Commit 0df6b1d

Browse files
Create Dayofprogrammer
1 parent f581e7e commit 0df6b1d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Dayofprogrammer

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/python
2+
import sys
3+
y = int(raw_input().strip())
4+
# your code goes here
5+
months = {0:31,1:28,2:31,3:30,4:31,5:30,6:31,7:31,8:30,9:31,10:30,11:31}
6+
if y <= 1917:
7+
tot = 0
8+
for i in range(12):
9+
if tot + months[i] > 256:
10+
break
11+
if y % 4 == 0 and i == 1:
12+
tot = tot + 29
13+
else:
14+
tot = tot + months[i]
15+
ans = ""
16+
day = 256 - tot
17+
month = i + 1
18+
ans = ans + str(day) + ".0" + str(month) + "." + str(y)
19+
print ans
20+
elif y == 1918:
21+
tot = 0
22+
for i in range(12):
23+
if tot + months[i] > 256:
24+
break
25+
if i == 1:
26+
tot = tot + 15
27+
else:
28+
tot = tot + months[i]
29+
ans = ""
30+
day = 256 - tot
31+
month = i + 1
32+
ans = ans + str(day) + ".0" + str(month) + "." + str(y)
33+
print ans
34+
else:
35+
tot = 0
36+
for i in range(12):
37+
if tot + months[i] > 256:
38+
break
39+
if (y % 400 == 0 or (y % 4 == 0 and y % 100 != 0)) and i == 1:
40+
tot = tot + 29
41+
else:
42+
tot = tot + months[i]
43+
ans = ""
44+
day = 256 - tot
45+
month = i + 1
46+
ans = ans + str(day) + ".0" + str(month) + "." + str(y)
47+
print ans

0 commit comments

Comments
 (0)