[problem description]
During his academic vacation, Professor M.A. Ya made an amazing discovery on the ancient Maya calendar. From an old and tricky message, the professor found that Maya civilization takes 365 days as a year, called Haab, and contains 19 months. The first 18 months have 20 days each month. The names of the months are pop, no, zip, zotz, tzec, XUL, yoxkin, mol, Chen, Yax, Zac, CEH, MAC, kankin, Muan, Pax, koyab and cumhu. The number of days per month is expressed in numbers, from 0 to 19, not by name. The last month of Haab is called uayet, which has five days, expressed as 0, 1, 2, 3 and 4. The Mayans thought this month was unlucky, the courts were closed, trade stopped, and people even stopped cleaning the floor.
For religious purposes, Maya people use another calendar called Tzolkin (Winter Youth). A year is divided into 13 periods of 20 days each. Each day is represented by a number pair represented by a number and a date name. Use 20 names: iMix, IK, akbal, Kan, chicchan, CIMI, Manik, lamat, muluk, OK, Chuen, EB, Ben, IX, MEM, CIB, Caban, eznab, Canac, AHAU, and 13 numbers for double recycling.
Please note that every day has a clear description. For example, the day at the beginning of the year is described as follows:
1 iMix, 2 IK, 3 akbal, 4 Kan, 5 chicchan, 6 CIMI, 7 Manik, 8 lamat, 9 muluk, 10 OK, 11 Chuen, 12 EB, 13 Ben, 1 IX, 2 MEM, 3 CIB, 4 Caban, 5 eznab, 6 Canac, 7 AHAU, 8 iMix, 9 IK, 10 akbal
The year (including Haab and Tzolkin) is represented by the numbers 0, 1,..., and the number 0 is the beginning of the world. Therefore, the first day is expressed as:
Haab: 0. pop 0
Tzolkin: 1 imix 0
Please help Professor m.a.ya write a program to convert Haab calendar into Tzolkin calendar.
[input form]
In Haab, the date is expressed in the following form:
NumberOfTheDay. Month Year
The first line of the input file contains the number of input dates in the file. The next N lines contain n dates in Haab calendar format, and the year is less than 5000.
[output form]
Tzolkin dates are in the following format:
Number NameOfTheDay Year
The output includes N lines. The date in Tzolkin calendar format is output in the order corresponding to the input date.
[sample input]
3
10.zac 0
0.pop 0
10.zac 1995
【样例输出】
3 chuen 0
1 imix 0
9 cimi 2801
【样例说明】
【评分标准】
#include<iostream>
#include<string>
using namespace std;
void turn(int x,string a,int y){//转换函数
int z=0,days,month,year,date;
string c;
if(a=="pop")z=1;
else if(a=="no")z=2;
else if(a=="zip")z=3;
else if(a=="zotz")z=4;
else if(a=="tzec")z=5;
else if(a=="xul")z=6;
else if(a=="yoxkin")z=7;
else if(a=="mol")z=8;
else if(a=="chen")z=9;
else if(a=="yax")z=10;
else if(a=="zac")z=11;
else if(a=="ceh")z=12;
else if(a=="macc")z=13;
else if(a=="kankin")z=14;
else if(a=="muan")z=15;
else if(a=="pax")z=16;
else if(a=="koyab")z=17;
else if(a=="cumhu")z=18;
else if(a=="uayet")z=19;
days=x+1+(z-1)*20+y*365;//算出是世界开始的第几天
date=days%13;
if(date==0) date+=13;
month=days%20;
year=days/260;//260天为1年
switch(month){//将月份期间转化为字符串
case 1:c="imix";break;
case 2:c="ik";break;
case 3:c="akbal";break;
case 4:c="kan";break;
case 5:c="chicchan";break;
case 6:c="cimi";break;
case 7:c="manik";break;
case 8:c="lamat";break;
case 9:c="muluk";break;
case 10:c="ok";break;
case 11:c="chuen";break;
case 12:c="eb";break;
case 13:c="ben";break;
case 14:c="ix";break;
case 15:c="mem";break;
case 16:c="cib";break;
case 17:c="caban";break;
case 18:c="eznab";break;
case 19:c="canac";break;
case 0:c="ahau";break;
}
cout<<date<<' '<<c<<' '<<year<<endl;
}
int main(){
int n;
cin>>n;
int num[n][2];
string mon[n];
char point;
for(int i=0;i<n;i++)cin>>num[i][0]>>point>>mon[i]>>num[i][1];
for(int i=0;i<n;i++)turn(num[i][0],mon[i],num[i][1]);
return 0;
}