Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求助,WA 测试用例都试了,请大侠帮忙看看

Posted by szpgod at 2011-04-29 12:58:32 on Problem 1008
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{   
    int num=0;
    int i=0;
    int sumDay=0;
    char day[1000][100]={0};
    char month[1000][100]={0};
    char tzoMon[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
    int year[1000]={0};
    int outYear=0;
    int outDay=0;
    int printDay=0;
    int printMon=0;
    scanf("%d",&num);
    for (i=0;i<num;i++)
    {
        scanf("%s %s %d",day[i],month[i],&year[i]);
    }
    printf("%d\n",num);
    for (i=0;i<num;i++)
    {   
        if (strcmp(month[i],"pop")==0)
        {
            sumDay=year[i]*365+atoi(day[i]);
        }
        else if (strcmp(month[i],"no")==0)
        {
            sumDay=year[i]*365+20+atoi(day[i]);
        }
        else if (strcmp(month[i],"zip")==0)
        {
            sumDay=year[i]*365+40+atoi(day[i]);
        }
        else if (strcmp(month[i],"zotz")==0)
        {
            sumDay=year[i]*365+60+atoi(day[i]);
        }
        else if (strcmp(month[i],"tzec")==0)
        {
            sumDay=year[i]*365+80+atoi(day[i]);
        }
        else if (strcmp(month[i],"xul")==0)
        {
            sumDay=year[i]*365+100+atoi(day[i]);
        }
        else if (strcmp(month[i],"yoxkin")==0)
        {
            sumDay=year[i]*365+120+atoi(day[i]);
        }
        else if (strcmp(month[i],"mol")==0)
        {
            sumDay=year[i]*365+140+atoi(day[num]);
        }
        else if (strcmp(month[i],"chen")==0)
        {
            sumDay=year[i]*365+160+atoi(day[i]);
        }
        else if (strcmp(month[i],"yax")==0)
        {
            sumDay=year[i]*365+180+atoi(day[i]);
        }
        else if (strcmp(month[i],"zac") ==0)
        {
            sumDay=year[i]*365+200+atoi(day[i]);
        }
        else if (strcmp(month[i],"ceh")==0)
        {
            sumDay=year[i]*365+220+atoi(day[i]);
        }
        else if (strcmp(month[i],"mac")==0)
        {
            sumDay=year[i]*365+240+atoi(day[i]);
        }
        else if (strcmp(month[i],"kankin")==0)
        {
            sumDay=year[i]*365+260+atoi(day[i]);
        }
        else if (strcmp(month[i],"muan")==0)
        {
            sumDay=year[i]*365+280+atoi(day[i]);
        }
        else if (strcmp(month[i],"pax")==0)
        {
            sumDay=year[i]*365+300+atoi(day[i]);
        }
        else if (strcmp(month[i],"koyab")==0)
        {
            sumDay=year[i]*365+320+atoi(day[i]);
        }
        else if (strcmp(month[i],"cumhu")==0)
        {
            sumDay=year[i]*365+340+atoi(day[i]);
        }
        else if (strcmp(month[i],"uayet")==0)
        {
            sumDay=year[i]*365+360+atoi(day[i]);
        }
        sumDay++;
        outYear =sumDay/260;
        outDay  =sumDay%260;
        if (outDay == 0)
        {
            outYear--;
            printMon =13;
            printDay =20;
        }
        else
        {
            printDay=outDay%20;
            printMon=outDay%13;
            if (printDay ==0 )
            {
                printDay=20;
            }
            if (printMon==0)
            {
                printMon =13;
            }

        }
        
        printf("%d %s %d\n",(printMon),tzoMon[printDay-1],outYear);

      }
        

    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator