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

POJ 1008 Maya Calendar 水模拟

时间:2015-07-07 22:43:10      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:

有中文意思。

注意HOLLY法月份和天数是一起滚动的= = 

 

要输出总组数,坑哭

技术分享
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
#include <string>
#include<iostream>
using namespace std;
map<string, int>f;
const int N = 22;
char str[N][10] = {"imix", "ik", "akbal", "kan", "chicchan",
    "cimi", "manik", "lamat", "muluk", "ok",
    "chuen", "eb", "ben", "ix", "mem",
    "cib", "caban", "eznab", "canac", "ahau"};
void init(){
    f["pop"] = 1;f["no"] = 2;f["zip"] = 3;f["zotz"] = 4;f["tzec"] = 5;
    f["xul"] = 6;f["yoxkin"] = 7;f["mol"] = 8;f["chen"] = 9;  f["yax"] = 10;
    f["zac"] = 11;f["ceh"] = 12;f["mac"] = 13;f["kankin"] = 14;f["muan"] = 15;
    f["pax"] = 16;f["koyab"] = 17;f["cumhu"] = 18;f["uayet"] = 19;
}

int main(){
    init();
    int TC, i, n, day, year, sumday, month;
    string st;
    char temp;
    scanf("%d", &TC);
    printf("%d\n", TC);
    while(TC--){
        cin >> day >> temp >> st >> year;
    
        //haab to sum
        sumday = year * 365;
        month = f[st];

        sumday += (month-1)*20 + day;//printf("%d\n", sumday);
        //sum to Tzolkin
        year = sumday / 260;
       // sumday %= 260;
        day = sumday % 20 ;
        month = sumday %13 + 1;
        printf("%d %s %d\n", month, str[day], year);
    }
    return 0;
}
View Code

 

POJ 1008 Maya Calendar 水模拟

标签:

原文地址:http://www.cnblogs.com/bbbbbq/p/4628692.html

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