• POJ 1008 Maya Calendar 水模拟


    有中文意思。

    注意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
    ", TC);
        while(TC--){
            cin >> day >> temp >> st >> year;
        
            //haab to sum
            sumday = year * 365;
            month = f[st];
    
            sumday += (month-1)*20 + day;//printf("%d
    ", sumday);
            //sum to Tzolkin
            year = sumday / 260;
           // sumday %= 260;
            day = sumday % 20 ;
            month = sumday %13 + 1;
            printf("%d %s %d
    ", month, str[day], year);
        }
        return 0;
    }
    View Code
  • 相关阅读:
    【原创】C++11:左值和右值(深度分析)
    【基础核心理论】运算符重载
    左值与右值引用 详解
    托盘图标编程
    C/C++ 数组与指针
    webpack 4.0改版问题
    mysql5.7安装记录
    equals方法
    【原创】IO流:读写操作研究(输入流)
    为什么重写equals一定要重写hashCode?
  • 原文地址:https://www.cnblogs.com/bbbbbq/p/4628692.html
Copyright © 2020-2023  润新知