Written by
daweibayu
on
on
Poj 1008
#include <iostream>
#include <map>
#include <string>
using namespace std;
string hollyMounth[20] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
string haabMounth[18] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"};
const int hollyDays = 13*20;
int haabToDays(int day, int year, const string& mounth)
{
int i = 0;
while(i < 18)
{
if(haabMounth[i].compare(mounth.c_str()) == 0)
break;
i++;
}
return year*365 + i*20 + day;
}
void daysToHolly(int days)
{
int year = days / hollyDays;
days %= hollyDays;
printf("%d %s %d\n", (days % 13) + 1, hollyMounth[days % 20].c_str(), year);
}
int main()
{
int n, day, year;
string mounth;
scanf("%d", &n);
printf("%d\n", n);
while((n--) != 0)
{
scanf("%d. %s %d", &day, mounth.c_str(), &year);
int days = haabToDays(day, year, mounth);
daysToHolly(days);
}
}