【模拟与枚举】
#include <cstdio>
#include<cstring>
int main()
{
int n,num,year,month,i,m;
char cmonth[7],Haab[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol",
"chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"},
Tzolkin[20][9]={"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); //因为行号,wa了好几遍,无语
while(n--)
{
scanf("%d. %s %d",&num,&cmonth,&year);
for(i=0;i<19;i++)
{
if(!strcmp(cmonth,Haab[i])) {month=i;break;}
}
m=year*365+i*20+num;
//scanf("%d",&m);
year=m/260;month=m%20;num=(m+1)%13;
if((m+1)%13==0) //注意
{
num=13;
}
printf("%d %s %d\n",num,Tzolkin[month],year);
}
return 0;
}
我做的第一道模拟