POJ 1008 Maya Calendar

Posted Wisdom+.+

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了POJ 1008 Maya Calendar相关的知识,希望对你有一定的参考价值。

Maya Calendar

思路:日历转换,仔细一点。

代码:

 

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
#define ll long long
#define pb push_back
map<string,int>mp;
string a[19]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
string b[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int main()
{
    int n;
    for(int i=0;i<19;i++)mp[a[i]]=i;
    cin>>n;
    cout<<n<<endl;
    while(n--)
    {
        int day,year;
        char doc;
        string month;
        cin>>day>>doc>>month>>year;
        //cout<<month<<endl;
        int t=year*365+mp[month]*20+day;
        int year1=t/260;
        string day1=b[t%20];
        int day2=t%13+1;
        cout<<day2<< <<day1<< <<year1<<endl;
    }
    return 0;
}

 

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

[POJ] POJ1008 Maya Calendar

POJ1008 Maya Calendar

poj1008Maya Calendar

[POJ] #1008# Maya Calendar : 字符处理/同余问题

POJ1008 UVA300 UVALive5515 Maya Calendar日期计算

B - Maya Calendar(第二季水)