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

Re:I don't know where the mistake is,who can help me?

Posted by 320109 at 2008-10-03 14:28:43 on Problem 1008
In Reply To:I don't know where the mistake is,who can help me? Posted by:loving_you2000 at 2008-09-17 19:23:46
#include<cstdlib>
#include<iostream>
#include<string>
using namespace std;

int main()
{
    char *HaabMonth[20]=
    {"pop", "no", "zip", "zotz", "tzec", "xul","yoxkin", "mol", "chen",
     "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet",""};

    string HaabDay[20]=
    {"0.","1.","2.","3.","4.","5.","6.","7.","8.","9.","10.","11.","12.",
    "13.","14.","15.","16.","17.","18.","19."};

    string TzolkinName[20]=
    {"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk",
    "ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};

    int Case;
    string InputDay,InputMonth,OutputName;
    int InputYear,Days=0,OutputYear,OutputNumber,TempDay;
    cin>>Case;
    cout<<Case<<endl;
    for(int i=0;i< Case;i++)
    {
        Days = 0;
            cin>>InputDay>>InputMonth>>InputYear;
            Days += InputYear*365;
            for(int j=0;j<20;j++)
            {
                    if(InputMonth == HaabMonth[j])
                    {
                        Days+=j*20;
                    }
                    if(InputDay == HaabDay[j])
                    {
                        Days += j + 1;
                    }
            }
            if(Days%260 == 0)
            {
                     OutputYear   = (Days/260) - 1;
                     OutputNumber = 13;
                     OutputName   = TzolkinName[19];
            }
            else
            {
                OutputYear=Days/260;
                OutputNumber=Days%13;
                if(OutputNumber == 0)
                {
                    OutputNumber = 13;
                }
                TempDay=Days%20;
                if(TempDay == 0)
                 OutputName = TzolkinName[19];
                else
                 OutputName=TzolkinName[ TempDay - 1 ];
            }
            cout<<OutputNumber<<" "<<OutputName<<" "<<OutputYear<<endl;
            Days=0;
    }
    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