#include <stdio.h>
#include <string.h>
int mon2int(char *str);
int main() {
int n;
char *dayNames[20] = {"imix", "ik", "akbal", "kan",
"chicchan", "cimi", "manik", "lamat",
"muluk", "ok", "chuen", "eb",
"ben", "ix", "mem", "cib",
"caban", "eznab", "canac", "ahau"};
scanf("%d", &n);
printf("%d\n", n);
while (n > 0) {
int NumberOfTheDay, Year;
char Month[7];
scanf("%d. %s %d", &NumberOfTheDay, Month, &Year);
int days = Year * 365 + mon2int(Month) * 20 + NumberOfTheDay;
int year, number, dayNumber;
year = days / 260;
int remainder = days % 260;
number = remainder % 13 + 1;
dayNumber = remainder % 20;
printf("%d %s %d\n", number, dayNames[dayNumber], year);
n --;
}
return 0;
}
int mon2int(char *str) {
char *monthNames[19] = {"pop", "no", "zip",
"zotz", "tzec", "xul",
"yoxkin", "mol", "chen",
"yax", "zac", "ceh",
"mac", "kankin", "muan",
"pax", "koyab", "cumhu", "uayet"};
for (int i = 0; i < 19; i ++) {
if (!strcmp(monthNames[i], str)) {
return i;
}
}
return -1;
}
网友评论