9 cimi 2801
代码:
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ char habb[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; int n; int day; char month[10]; int year; char tkl[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk", "ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int i,j; int k; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d.%s %d",&day,month,&year); for(j=0;j<19;j++) if(strcmp(month,habb[j])==0){k=j;break;} int total=365*year+20*k+day; int yy=total/260; int m=total%260; int date=m%13+1; int index=m%20; //printf("%d\n",n); printf("%d %s %d\n",date,tkl[index],yy); } return 0;}提交后WC,发现是没有按照输出要求输出n
改成:
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ char habb[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; int n; int day; char month[10]; int year; char tkl[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk", "ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int i,j; int k; scanf("%d",&n); printf("%d\n",n); for(i=0;i<n;i++){ scanf("%d.%s %d",&day,month,&year); for(j=0;j<19;j++) if(strcmp(month,habb[j])==0){k=j;break;} int total=365*year+20*k+day; int yy=total/260; int m=total%260; int date=m%13+1; int index=m%20; printf("%d %s %d\n",date,tkl[index],yy); } return 0;}