The idea is to convert the input Haab calendar to 0.pop 0 days and calculate the Tzolkin calendar in the corresponding number of days
#include <stdio.h>#include<string.h>//20*18+5Charhaab[ +][Ten] = {"Pop","No","Zip","Zotz","Tzec","XUL","Yoxkin","Mol","Chen","Yax","Zac","CEH","mac","Kankin","Muan","Pax","Koyab","Cumhu","Uayet"};//13*20Chartzolkin[][Ten] = {"Imix","ik","Akbal","kan","Chicchan","Cimi","Manik","Lamat","Muluk","OK","Chuen","EB","Ben","IX","Mem","CIB","Caban","Eznab","Canac","Ahau"};//returns the array subscript for the corresponding monthintHaab_month (Char*ch) { inti; for(i =0; I < -; i++) { if(strcmp (haab[i],ch) = =0) returni; } return-1;}intMain () {intN; scanf ("%d", &N); intH_day, H_year, T_year, T_day; CharC; Charh_month[Ten], t_month[Ten]; //days for input time to 0.pop 0 intDays ; for(inti =0; I < n; i++) { days=0; scanf ("%d%c%s%d", &h_day, &c, H_month, &h_year); for(intj =0; J < Haab_month (H_month); J + +) { days+= -; //includes last one months plus 5 days (20-15) if(J = = -) Days-= the; } Days+ = (h_day+h_year*365+1); //year of the Tzolkin calendarT_year = days/260; days-= t_year*260; //the day of the Tzolkin calendar (first digit) gets the second bit through the Tzolkin arrayT_day = days% -; printf ("%d%s%d\n", T_day, tzolkin[days% --1], t_year); } return 0;}
"Blue Bridge Cup race" Mayan Calendar