Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

CHO2 - Editorial

$
0
0

PROBLEM LINK:

(https://www.hackerrank.com/challenges/day-of-the-programmer/problem)

Contest

Author:Vaisshnavi Yerrapothu

Tester:Vaisshnavi Yerrapothu

DIFFICULTY:

CAKEWALK.

PREREQUISITES:

Strings, Arrays.

PROBLEM:

Given a year ,y , find the date of the 256th day of that year according to the official Russian calendar during that year. Then print it in the format dd.mm.yyyy, where dd is the two-digit day, mm is the two-digit month, and yyyy is y.

EXPLANATION:

As it is very easy question, the code snippet will guide you. ` 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

AUTHOR'S AND TESTER'S SOLUTIONS:

Author's solution can be found [here] https://www.hackerrank.com/rest/contests/master/challenges/day-of-the-programmer/hackers/16wh1a05c01/download_solution


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>