zoukankan      html  css  js  c++  java
  • Maya Calendar POJ

    简述

    注意260天的情况,这个地方还是0年

    代码

    #include <iostream>
    #include <map>
    #include <sstream>
    using namespace std;
    map<string,int> bk;
    map<int,string> bk1;
    int main()
    {
      ios::sync_with_stdio(0);
      cin.tie(0);
      cout.tie(0);
      bk["pop"]=1;bk["no"]=2;bk["zip"]=3;bk["zotz"]=4;
      bk["tzec"]=5;bk["xul"]=6;bk["yoxkin"]=7;bk["mol"]=8;
      bk["chen"]=9;bk["yax"]=10;bk["zac"]=11;bk["ceh"]=12;
      bk["mac"]=13;bk["kankin"]=14;bk["muan"]=15;bk["pax"]=16;
      bk["koyab"]=17;bk["cumhu"]=18;bk["uayet"]=19;
      bk1[1]="imix";bk1[2]="ik";bk1[3]="akbal";bk1[4]="kan";
      bk1[5]="chicchan";bk1[6]="cimi";bk1[7]="manik";bk1[8]="lamat";
      bk1[9]="muluk";bk1[10]="ok";bk1[11]="chuen";bk1[12]="eb";bk1[13]="ben";
      bk1[14]="ix";bk1[15]="mem";bk1[16]="cib";bk1[17]="caban";bk1[18]="eznab";
      bk1[19]="canac";bk1[20]="ahau";
      int n;
      cin>>n;
      cout<<n<<"
    ";
      cin.get();
      while(n--)
      {
        string a;
        getline(cin,a);
        string t="";
        for(int i=0;i<a.size();i++)
        if(isdigit(a[i]))
        t+=a[i];
        else
        break;
        int l=t.size();
        l+=2;
        stringstream s;
        s<<t;
        int day;
        s>>day;
        day+=1;
        t="";
        for(int i=l;;i++)
        if(isalpha(a[i]))
        t+=a[i];
        else
        break;
        l+=t.size();
        //cout<<t<<"
    ";
        int month=bk[t];
        t="";
        l+=1;
        for(int i=l;i<a.size();i++)
        if(isdigit(a[i]))
        t+=a[i];
        stringstream s1;
        s1<<t;
        int year;
        s1>>year;
        //cout<<year<<" "<<month<<" "<<day<<"
    ";
        int sum=year*365+(month-1)*20+day;
        int ty;
        if(sum==0)
        ty=0;
        else
        ty=(sum-1)/260;
        int yu=(sum-1)%260+1;
        int td=(yu-1)%13+1;
        int st=(yu-1)%20+1;
        //cout<<st<<"
    ";
        cout<<td<<" "<<bk1[st]<<" "<<ty<<"
    ";
      }
    }
    
  • 相关阅读:
    分享几个个人觉得挺漂亮的导航 Jquery
    C#程序打成 一键安装包InstallShield
    腾讯显IP的API
    C#综合揭秘——细说事务
    2012最新JQuery插件
    Flex各种用法及使用技巧一
    win7管理员账户的启用方法
    禁用win7休眠
    win7下移动文件夹
    win7下转移搜狗文件临时文件夹和IE临时文件夹的方法
  • 原文地址:https://www.cnblogs.com/baccano-acmer/p/10170446.html
Copyright © 2011-2022 走看看