关键就是从0开始和从1开始的区别。
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;map<string,int> MH={{"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}
};string MT[20]={"imix","ik", "akbal","kan" ,"chicchan" ,"cimi" ,
"manik", "lamat", "muluk", "ok","chuen" ,"eb" ,"ben" ,"ix" ,"mem" ,"cib" ,"caban" , "eznab","canac" ,"ahau" };int main() {int n;scanf("%d",&n);getchar();printf("%d\n",n);while(n--){int d,m,y,days=0;;string M;char t[100],tt[10];gets(t);sscanf(t,"%d. %s %d",&d,tt,&y);M=tt;days=d+MH[M]*20+y*365+1;//days表示世界开始后的第几天 printf("%d %s %d\n",(days-1)%13+1,MT[(days-1)%20].c_str(),(days-1)/260); }return 0;
}