[BIO Logo] The British Informatics Olympiad is
the computing competition for schools and colleges.
We are proud to present BIO 2004, sponsored by Lionhead Studios.
Sponsored by Lionhead Studios

BIO2004 Round One question 1 - worked solution

Question 1
Mayan Calendar

The Mayan civilisation used three different calendars. In their long count calendar there were 20 days (called kins) in a uinal, 18 uinals in a tun, 20 tuns in a katun and 20 katuns in a baktun. In our calendar, we specify a date by giving the day, then month, and finally the year. The Maya specified dates in reverse, giving the baktun (1-20), then katun (1-20), then tun (1-20), then uinal (1-18) and finally the kin (1-20).

The Mayan date 13 20 7 16 3 corresponds to the date 1 January 2000 (which was a Saturday).

1 (a)
[24 marks]

Write a program which, given a Mayan date (between 13 20 7 16 3 and 14 1 15 12 3 inclusive), outputs the corresponding date in our calendar. You should output the month as a number.

You are reminded that, in our calendar, the number of days in each month is:

  Sample run
13 20 9 2 9
22 3 2001
1January31
2February28 / 29 (leap year)
3March31
4April30
5May31
6June30
7July31
8August31
9September30
10October31
11November30
12December31
  Within the range of dates for this question, every year divisible by 4 is a leap year.
1 (b)
[2 marks]
What are the Mayan dates for 1 February 2000 and 1 January 2001?
1 (c)
[3 marks]
The Maya believed the universe was destroyed and re-created every cycle of their calendar, which was 20 baktun in length. How many kins (days) are there in a cycle? What day of the week is the last day of the current cycle (20 20 20 18 20)?

A worked solution to the problem is in preparation.


The British Informatics Olympiad