Skip to content
Onsite

Day of the Programmer

EasyP3Coding

The Day of the Programmer is the 256th day of the year. Return its date in Russia for the given year as dd.mm.yyyy, using the calendar Russia used in that year:

  • Up to 1917: the Julian calendar, where a year is a leap year if it is divisible by 4.
  • From 1919: the Gregorian calendar, where a year is a leap year if it is divisible by 400, or divisible by 4 and not by 100.
  • 1918 was the transition year. After 31 January came 14 February, so 13 days were skipped and February 1918 had 15 days (14th to 28th).

A leap year has a 29-day February, other years 28.

Example 1

Input
year = 2017
Output
"13.09.2017"
Why
Not a leap year, so the 256th day is 13 September.

Example 2

Input
year = 2016
Output
"12.09.2016"
Why
A leap year, so it is 12 September.

Example 3

Input
year = 1800
Output
"12.09.1800"
Why
The year of the switch: 26 September.

Constraints

  • 1700 <= year <= 2700

Hints

Run checks the 3 visible tests, Submit all 12.