|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
The NASA has secretly built a Time machine which allows them to travel into the past. Its first application is to explore the Mayan culture. They have been able to gather some important dates from Maya monuments which are suitable for further investigation. They are now faced with a problem - they need to convert those Mayan dates to the Gregorian format, which is the only kind of input their time machine understands.
Write a conversion program to calculate the Gregorian date, the Mayan longcount and the Mayan ritual date for a given Gregorian date or Mayan longcount.
The starting date, day zero, for the Mayan calendar is the 13th of August 3114 BC (before Christ). From this day zero onwards the days to a certain date are counted. One day is called K’in, 20 K’in are a Winal. 18 Winal are a Tun, 20 Tun make a K’atun and 20 K’atun will form a Bak’tun. Example: 22.214.171.124.3 tells us that 12 Bak’tun, 4 K’atun, 9 Tun, 13 Winal and 3 K’in (days) have passed since August 13th 3114 BC.
Mayan Ritual Dates
The Mayans had the solar year with 365 days, there were no leap days to correct the calendar. The year was split in 18 month with 20 days and one month with 5 days. The names of the months are the following: Pob, Wo, Sip, Sotz’, Tzek, Xul, Yaxk’in, Mol, Ch’en, Yax, Sak, Keh, Mak, K’ank’in, Muwan, Pax, K’ayab, Kumk’u, Wayeb. The days of the month were numbered 1 to 19 (or 1 to 4), the last day of the month was noted as day zero of the following month (i.e. you would not write 20 Pop, but 0 Wo to note the last day of the first month, the same applies to the five day month called Wayeb, its last day 5 Wayeb is written 0 Pop).
Additionally to the months and days notation there is a notation which could be compared to our weeks and weekdays. Every day is labelled by both a number in the range from 1 to 13 and one of the following 20 names: Imix, Ik’, Ak’bal, K’an, Chikchan, Kimi, Manik’, Lamat, Muluk, Ok, Chuwen, Eb, Ben, Ix, Men, Kib, Kaban, Etz’nab, Kawak, Ahaw. Both the numbers and the names are running in cycles, so the count will go: 1 Imix, 2 Ik’, 3 Ak’bal, ... 13 Ben, 1 Ix, 2 Men. It will thus take a 260 day cycle (called the ritual year) until 1 Imix is counted again (compare Figure 1 on next page).
The weekday and month notation are used together as in the following example: 2 Kimi (weekday) 10 Yax (day and month). The 13th of August 3114 BC has the ritual date 4 Ahaw 8 Kumk’u.
In our calendar we use leap days. A leap day is inserted every 4 years, except every 100 years. Overruling this a leap day will be inserted every 400 years.
It is also important to know that there is no year 0. Accordingly, 31th of December 1 BC is followed by 1st of January AD 1. The last leap year before Christ is 1 BC (the 400 year rule applies here), the next leap year after that is AD 4.
The first line contains the number of scenarios.
For each scenario, there is one line containing either a Mayan longcount or a Gregorian date in the following formats:
We will neither ask for dates preceding August 13th 3114 BC, nor for dates after 126.96.36.199.0 which is the last day in the Mayan longcount calendar. Also, you will never be given invalid dates in either calendar.
The output for every scenario begins with a line containing “Scenario #i:”, where i is the number of the scenario starting at 1. Then, regardless of the format given in the input, three lines have to be printed representing the given date in the following order:
After these three lines, always a blank line must be printed.
2 13/08/3114 BC 188.8.131.52.14
Scenario #1: 13/8/3114 BC 0.0.0.0.0 4 Ahaw 8 Kumk’u Scenario #2: 28/6/2003 AD 184.108.40.206.14 9 Ix 2 Tzek
Figure 1: Mayan Ritual Dates