不知道这道题有什么难点,通过率竟然会<15%。 晕。
贴上代码:
#include<stdio.h> #include<stdlib.h> #include<string.h> #define HaabMonth 19 #define HaabYear 365 #define TzolkinMonth 20 #define TzolkinYear 260 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 getHaabMonth(char *month) { for(int i=0;i<HaabMonth;i++) { if(strcmp(Haab[i],month)==0) return i; } return -1; } int main(int argc, char* argv[]) { freopen("input.txt","r",stdin); int n; scanf("%d",&n); printf("%d\n",n); int day,year; char month[10]; int day1,year1; int month1; while(n--) { scanf("%d. %s %d",&day,month,&year); int m=getHaabMonth(month); int d=m*20+day+year*HaabYear; year1=d/TzolkinYear; d=d%TzolkinYear; month1=d%20; day1=d%13+1; printf("%d %s %d\n",day1,Tzolkin[month1],year1); } return 0; }