zoukankan      html  css  js  c++  java
  • POJ 1008 简单模拟题

    e.... 虽然这是一道灰常简单的模拟题、但是米做的时候没有读懂第二个日历的计时方法。然后捏。敲完之后华丽的WA了进一个点。坑点就在一年的最后一天你是该输出本年的。e ...但是我好想并没有。、看discuss里好想被坑的人还不少。总天数能直接整除260的时候。年数要减1。

    不喜欢做模拟.....5555....

    附代码:

    #include<stdio.h>
    #include<string.h>
    #include<iostream>
    #include<string>
    #include<map>
    using namespace std;


    string Maya_name[20] = {"pop", "no", "zip", "zotz", "tzec",  "xul", "yoxkin", "mol", "chen", "yax",  "zac", "ceh", "mac", "kankin", "muan",  "pax", "koyab", "cumhu", "uayet"};
    string Holly_name[21] = {"imix", "ik", "akbal", "kan", "chicchan",   "cimi", "manik", "lamat", "muluk", "ok",   "chuen", "eb", "ben", "ix", "mem",   "cib", "caban", "eznab", "canac", "ahau"};

    int main()
    {
        map<string, int>m;
        m.clear();
        for (int i=0; i<19; ++i)
        {
            m[Maya_name[i]] = i;
        }

        map<int, string>mm;
        mm.clear();
        for (int i=0; i<20; ++i)
        {
            mm[i+1] = Holly_name[i];
        }

        int t, total;
        int day, year;
        char temp;
        string month;
        while(cin >> t)
        {
            cout << t << endl;
            while(t--)
            {
                total = 0;
                cin >> day >> temp >> month >> year;
                int tm = m[month];
                total += year * 365 + tm * 20 + day + 1;
               // cout << total << "== ";
                year = total / 260;
                int tot = total;
                tot %= 260;
                tm = tot % 20;
                if (tm == 0) tm = 20;
                day = total % 13;
                if (day == 0) day = 13;
                if (total % 260 == 0)
                {
                    year -= 1;
                }
                cout << day << ' ' << mm[tm] << ' ' << year << endl;
            }
        }
        return 0;
    }


  • 相关阅读:
    How To Build CyanogenMod Android for smartphone
    CentOS安装Code::Blocks
    How to Dual boot Multiple ROMs on Your Android SmartPhone (Upto Five Roms)?
    Audacious——Linux音乐播放器
    How to Dual Boot Multiple ROMs on Your Android Phone
    Everything You Need to Know About Rooting Your Android Phone
    How to Flash a ROM to Your Android Phone
    什么是NANDroid,如何加载NANDroid备份?
    Have you considered compiled a batman-adv.ko for android?
    BATMAN—Better Approach To Mobile Adhoc Networking (B.A.T.M.A.N.)
  • 原文地址:https://www.cnblogs.com/icode-girl/p/4600776.html
Copyright © 2011-2022 走看看