poj1008

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
}

 

以上是关于poj1008的主要内容,如果未能解决你的问题,请参考以下文章

[POJ] POJ1008 Maya Calendar

poj1008

poj1008

POJ1008 Maya Calendar

POJ1008

poj1008Maya Calendar