Friday, February 7, 2020

Day of the Programmer : Algorithms - Implementation

#The solution in Python3 is as follows:


def solve(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
y=int(input())
print(solve(y))

#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!