• poj 1008 Maya Calendar(简单模拟)


    最近在做模拟题,感觉自己编码能力太差了,想通过模拟题好好提高一下编码能力!

    这是一道简单的编码题,本以为可以很快就解决的,结果几乎花了我一上午的时间,失败啊~~~

    最后看了discuss里给的一组测试数据才把它给过了,唉,考虑问题不全面啊!!直接打表就行了~

    贴代码:

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

    struct node
    {
    int d;
    char mon[10];
    };
    node date[260] = {{1,"imix"},
    {2,"ik"},{3,"akbal"},{4,"kan"},{5,"chicchan"},{6,"cimi"},{7,"manik"},{8,"lamat"},{9,"muluk"},{10,"ok"},{11,"chuen"},{12,"eb"},{13,"ben"},{1,"ix"},{2,"mem"},
    {3,"cib"},{4,"caban"},{5,"eznab"},{6,"canac"},{7,"ahau"},{8,"imix"},{9,"ik"},{10,"akbal"},{11,"kan"},{12,"chicchan"},{13,"cimi"},{1,"manik"},{2,"lamat"},
    {3,"muluk"},{4,"ok"},{5,"chuen"},{6,"eb"},{7,"ben"},{8,"ix"},{9,"mem"},{10,"cib"},{11,"caban"},{12,"eznab"},{13,"canac"},{1,"ahau"},{2,"imix"},{3,"ik"},{4,"akbal"},
    {5,"kan"},{6,"chicchan"},{7,"cimi"},{8,"manik"},{9,"lamat"},{10,"muluk"},{11,"ok"},{12,"chuen"},{13,"eb"},{1,"ben"},{2,"ix"},{3,"mem"},{4,"cib"},{5,"caban"},
    {6,"eznab"},{7,"canac"},{8,"ahau"},{9,"imix"},{10,"ik"},{11,"akbal"},{12,"kan"},{13,"chicchan"},{1,"cimi"},{2,"manik"},{3,"lamat"},{4,"muluk"},{5,"ok"},{6,"chuen"},
    {7,"eb"},{8,"ben"},{9,"ix"},{10,"mem"},{11,"cib"},{12,"caban"},{13,"eznab"},{1,"canac"},{2,"ahau"},{3,"imix"},{4,"ik"},{5,"akbal"},{6,"kan"},{7,"chicchan"},
    {8,"cimi"},{9,"manik"},{10,"lamat"},{11,"muluk"},{12,"ok"},{13,"chuen"},{1,"eb"},{2,"ben"},{3,"ix"},{4,"mem"},{5,"cib"},{6,"caban"},{7,"eznab"},{8,"canac"},
    {9,"ahau"},{10,"imix"},{11,"ik"},{12,"akbal"},{13,"kan"},{1,"chicchan"},{2,"cimi"},{3,"manik"},{4,"lamat"},{5,"muluk"},{6,"ok"},{7,"chuen"},{8,"eb"},{9,"ben"},
    {10,"ix"},{11,"mem"},{12,"cib"},{13,"caban"},{1,"eznab"},{2,"canac"},{3,"ahau"},{4,"imix"},{5,"ik"},{6,"akbal"},{7,"kan"},{8,"chicchan"},{9,"cimi"},{10,"manik"},
    {11,"lamat"},{12,"muluk"},{13,"ok"},{1,"chuen"},{2,"eb"},{3,"ben"},{4,"ix"},{5,"mem"},{6,"cib"},{7,"caban"},{8,"eznab"},{9,"canac"},{10,"ahau"},{11,"imix"},
    {12,"ik"},{13,"akbal"},{1,"kan"},{2,"chicchan"},{3,"cimi"},{4,"manik"},{5,"lamat"},{6,"muluk"},{7,"ok"},{8,"chuen"},{9,"eb"},{10,"ben"},{11,"ix"},{12,"mem"},
    {13,"cib"},{1,"caban"},{2,"eznab"},{3,"canac"},{4,"ahau"},{5,"imix"},{6,"ik"},{7,"akbal"},{8,"kan"},{9,"chicchan"},{10,"cimi"},{11,"manik"},{12,"lamat"},
    {13,"muluk"},{1,"ok"},{2,"chuen"},{3,"eb"},{4,"ben"},{5,"ix"},{6,"mem"},{7,"cib"},
    {8,"caban"},{9,"eznab"},{10,"canac"},{11,"ahau"},{12,"imix"},{13,"ik"},{1,"akbal"},{2,"kan"},{3,"chicchan"},{4,"cimi"},{5,"manik"},{6,"lamat"},{7,"muluk"},{8,"ok"},
    {9,"chuen"},{10,"eb"},{11,"ben"},{12,"ix"},{13,"mem"},{1,"cib"},{2,"caban"},{3,"eznab"},{4,"canac"},{5,"ahau"},{6,"imix"},{7,"ik"},{8,"akbal"},{9,"kan"},
    {10,"chicchan"},{11,"cimi"},{12,"manik"},{13,"lamat"},{1,"muluk"},{2,"ok"},{3,"chuen"},{4,"eb"},{5,"ben"},{6,"ix"},{7,"mem"},{8,"cib"},{9,"caban"},{10,"eznab"},
    {11,"canac"},{12,"ahau"},{13,"imix"},{1,"ik"},{2,"akbal"},{3,"kan"},{4,"chicchan"},{5,"cimi"},{6,"manik"},{7,"lamat"},{8,"muluk"},{9,"ok"},{10,"chuen"},{11,"eb"},
    {12,"ben"},{13,"ix"},{1,"mem"},{2,"cib"},{3,"caban"},{4,"eznab"},{5,"canac"},{6,"ahau"},{7,"imix"},{8,"ik"},{9,"akbal"},{10,"kan"},{11,"chicchan"},{12,"cimi"},
    {13,"manik"},{1,"lamat"},{2,"muluk"},{3,"ok"},{4,"chuen"},{5,"eb"},{6,"ben"},{7,"ix"},{8,"mem"},{9,"cib"},{10,"caban"},{11,"eznab"},{12,"canac"},{13,"ahau"}};
    char mon[19][10]={"pop","no","zip","zotz","tzec" ,"xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};


    int main()
    {
    int d,y,n,sum,i,k;
    char s[10],x;

    scanf("%d",&n);
    printf("%d\n",n);
    while(n--)
    {
    cin>>d>>x>>s>>y;
    for(i=0;i<19;i++)
    if(strcmp(s,mon[i])==0)
    break;
    sum=y*365+i*20+d+1;
    if(sum%260)
    printf("%d %s %d\n",date[sum%260-1].d,date[sum%260-1].mon,sum/260);
    else
    printf("%d %s %d\n",date[259].d,date[259].mon,sum/260-1);
    }
    return 0;
    }



  • 相关阅读:
    SpringCloud笔记(一)服务注册与发现
    个人备忘录
    ActiveMQ 消息持久化到Mysql数据库
    染色 [组合数 容斥]
    各种图床
    NOIP2012 疫情控制
    网格计数
    找钱 [多重背包 计数]
    序列[势能线段树]
    牛客挑战赛33 B-鸽天的放鸽序列
  • 原文地址:https://www.cnblogs.com/misty1/p/2435751.html
Copyright © 2020-2023  润新知