zoukankan      html  css  js  c++  java
  • 【POJ】1008 Maya Calendar

    参考:https://blog.csdn.net/u011392408/article/details/28866779

    https://blog.csdn.net/qq_36424540/article/details/78234240

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <cstring>
     4 using namespace std;
     5 int d,y;
     6 string s;
     7 //string sh[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu"};
     8 //string st[]={"","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
     9 char sh[25][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};//用strig数组过不了,望来个大神解答一下!
    10 char st[25][10]={"","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
    11 int turn(int dd,string ss,int yy)//求总的天数
    12 {
    13     int days,i;
    14     for (i=0;ss!=sh[i];i++);
    15     days=20*i+dd+yy*365;
    16     return days;
    17 }
    18 int main()
    19 {
    20     int t;
    21 //    freopen("F:\ACM\text.txt","r",stdin);
    22     while (cin>>t)
    23     {
    24         cout<<t<<endl;
    25         while (t--)
    26         {
    27             char c;
    28             cin>>d>>c>>s>>y;
    29             int real=turn(d,s,y)+1;
    30             int yt=real/260,days=real%260;//yt为转化后的年
    31             if (days==0)
    32             {
    33                 yt--;
    34                 days=260;
    35             }
    36             int dt=days%13;//int dt=days%13+1,dn=days%20+1这样写是不对的!
    37             if (dt==0)
    38             {
    39                 dt=13;
    40             }
    41             int dn=days%20;
    42             if (dn==0)
    43             {
    44                 dn=20;
    45             }
    46             cout<<dt<<' '<<st[dn]<<' '<<yt<<endl;
    47         }
    48     }
    49 
    50     return 0;
    51 }
  • 相关阅读:
    javascript 备忘 细节 相关
    内存泄漏
    css相关 细节 优化 备忘
    nodeType
    事件冒泡 模型
    两个感叹号作用
    非冒泡事件
    DOM 对象
    Quartz2D 之 绘制文本
    Voilin 与 乐谱
  • 原文地址:https://www.cnblogs.com/hemeiwolong/p/9394949.html
Copyright © 2011-2022 走看看