範例程式碼 uva300
//uva300
#include <exception>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int n = 0;
const map<string, int> Haab{
{"pop", 0}, {"no", 1}, {"zip", 2}, {"zotz", 3}, {"tzec", 4},
{"xul", 5}, {"yoxkin", 6}, {"mol", 7}, {"chen", 8}, {"yax", 9},
{"zac", 10}, {"ceh", 11}, {"mac", 12}, {"kankin", 13}, {"muan", 14},
{"pax", 15}, {"koyab", 16}, {"cumhu", 17}, {"uayet", 18}};
const vector<string> t_name{"imix", "ik", "akbal", "kan", "chicchan",
"cimi", "manik", "lamat", "muluk", "ok",
"chuen", "eb", "ben", "ix", "mem",
"cib", "caban", "eznab", "canac", "ahau"};
cin >> n;
cout << n << endl;
for (int i = 0; i < n; i++) {
int h_year = 0, h_day = 0, sum = 0;
string h_strday = "", h_month = "";
cin >> h_strday >> h_month >> h_year;
h_strday.erase(h_strday.end() - 1);
h_day = stoi(h_strday);
try {
sum = h_day + 20 * Haab.at(h_month) + 365 * h_year;
} catch (const out_of_range& e) {
cerr << e.what() << " " << h_month << endl;
};
cout << sum % 13 + 1 << " " << t_name[sum % 20] << " " << sum / 260
<< endl;
}
return 0;
}