码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 1008 Maya Calendar

时间:2017-08-08 19:34:47      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:cout   icc   http   get   思路   pre   cal   poj   lam   

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

标签:cout   icc   http   get   思路   pre   cal   poj   lam   

原文地址:http://www.cnblogs.com/widsom/p/7307986.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!