试用代码片功能
#include
#include
using namespace std;
const string haabMonthNames[] = {"pop", "no", "zip", "zotz", "tzec", "xul",
"yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan",
"pax", "koyab", "cumhu","uayet"};
const string hollyMonthNames[] = {"imix", "ik", "akbal", "kan", "chicchan",
"cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem",
"cib", "caban", "eznab", "canac", "ahau"};
int GetMonth(const string name)
{
for(int i = 0; i <= 18; ++i)
if( name == haabMonthNames[i] )
return i;
return -1;
}
string GetMonthName(int i)
{
return hollyMonthNames[i];
}
int main()
{
int n;
cin >> n;
cout << n << endl;
int totalDays = 0;
int day, year;
char dot;
string monthName;
for(int i = 0; i < n; ++i)
{
cin >> day >> dot ;
cin >> monthName >> year;
totalDays = day + GetMonth(monthName)*20 + year*365;
cout << totalDays%13 + 1 << " " ;
cout << hollyMonthNames[totalDays%20] << " ";
totalDays += 1;
cout << totalDays/260 - (totalDays%260?0:1) << endl;
}
return 0;
}