POJ_1008_Maya Calendar

//简单模拟,但是要细心 ///开始的时候没有注意要输出set数目,不细心 ///注意:1.year是从0开始编号的,天数也是 /// 2.260天是算第0年,同理 #include<stdio.h> #include<stdlib.h> #include<string.h> char Haab[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen",/ "yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char Tzolkin_Day[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat",/ "muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int cas; int main() { scanf("%d",&cas); printf("%d/n",cas); while(cas--) { char s[10],month[10]; long year,day,len,i,j,num; long total; scanf("%s%s%d",s,month,&year); if(!year)total=0; else total=year*365; len=strlen(s); s[len-1]='/0'; sscanf(s,"%d",&day); for(i=0;i<19;i++) if(!strcmp(month,Haab[i])) break; total+=20*(i-0)+day+1; year=total/260; j=total%260; if(j==0) year--; if(j==0) j=260; num=j%13; if(num==0) num=13; day=j%20; if(!day) day=19; else day--; printf("%d %s %d/n",num,Tzolkin_Day[day],year); } return 0; }

你可能感兴趣的:(POJ_1008_Maya Calendar)