OpenJudge

哪位大侠帮我看看代码哪里错了,老是通不过……

  • nan
    nan 12.2.12 回复

    #include "stdio.h"
    #include "string.h"
    int main()
    {
    char month_1[18][9]={"pop","no"," zip", "zotz"," tzec"," xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan"," pax", "koyab", "cumhu"};
    char month_2[20][9]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
    int n;
    int day[500];
    char month[500][9];
    char inputmonth[9];
    int inputyear;
    int inputday;
    int year[500];
    scanf("%d",&n);
    for(int counter=0;counter<n;counter++)
    {
    int total=0;
    int i;
    scanf("%d.%s%d",&inputday,inputmonth,&inputyear);
    if(strcmp(inputmonth,"uayet")==0)
    {
    total=total+inputyear*365+360+inputday;
    }
    else
    {
    for(i=0;;i++)
    {
    if(strcmp(inputmonth,month_1[i])==0)
    {
    break;
    }
    }
    total=total+inputyear*365+20*i+inputday;
    }
    year[counter]=total/260;
    day[counter]=(total%13)+1;
    strcpy(month[counter],month_2[total%20]);
    }
    printf("%d\n",n);
    for(int k=0;k<n;k++)
    {
    printf("%d %s %d\n",day[k],month[k],year[k]);
    }
    return 0;
    }

  • 路光
    路光 18.2.7 回复

    你忘记粘贴Haab最后一个月了

想要评论吗?

注册OpenJudge账号,如果您已经注册,请先登入