poj1008

#include<iostream>
#include<string>
using namespace std;
int n;
int day,year;
char month[10];


char haab[19][7]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};

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

int main()
{
    //freopen("input.txt","r",stdin); 
    cin>>n;
    cout<<n<<endl;
    while(n--)
    {
        scanf("%d. %s %d",&day,month,&year);
        int monthnum=0,total=0;
        for(int i=0;i<19;i++)
            if (strcmp(haab[i],month)==0)
                monthnum=i;
    
        total=year*365+monthnum*20+day+1;
        //cout<<total<<endl;
        if(total%13==0)
            cout<<13<<' ';
        else
            cout<<total%13<<' ';
        if(total%20==0) 
            cout<<tzolkin[19]<<' ';
        else
            cout<<tzolkin[total%20-1]<<' ';
        if(total%260==0)
            cout<<total/260-1<<endl;
        else
            cout<<total/260<<endl;

    
    }
    return 0;
}

 

posted on 2017-05-03 15:30  bbcai  阅读(87)  评论(0编辑  收藏  举报