poj1008_Maya_Calendar

历法的转换。

 #include <stdio.h>
#include <math.h>
#include <string.h>
char Haab[][]={
"pop","no","zip","zotz","tzec","xul","yoxkin","mol",
"chen","yax","zac","ceh","mac","kankin","muan","pax",
"koyab","cumhu","uayet"
};
char Tzolkin[][]={
"imix","ik","akbal","kan","chicchan","cimi","manik",
"lamat","muluk","ok","chuen","eb","ben","ix","mem",
"cib","caban","eznab","canac","ahau"
};
int count(int day,char month[],int year){
int tot=;
tot+=(day+);
int i;
for(i=;i<;++i){
if(strcmp(month,Haab[i])==){
tot+=(i*);
break;
}
}
tot+=(year*);
return tot;
}
int main(){
int t,i,tot;
int day,year;
int m;
char month[];
while(~scanf("%d",&t)){
printf("%d\n",t);
for(i=;i<t;++i){
scanf("%d. %s %d",&day,month,&year);
tot=count(day,month,year);
m=(tot-)%;
day=(tot-)%;
day++;
if(day>){
day=(day%)+;
}else
year=(tot-)/;
printf("%d %s %d\n",day,Tzolkin[m],year);
}
}
return ;
}
上一篇:Redhat Linux下的python版本号升级


下一篇:spring结合Quartz的集群功能实现