Maya Calendar

http://poj.org/problem?id=1008

按第一种记录方法算出总天数,然后按第二种记录方式输出。

#include<stdio.h>
#include<string.h>
char Hab[20][11] = { "","pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet" };
char Tzo[21][11] = {"","imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
int main()
{
    int t,i,year,day,ans;
    char s[5],str[11];
    scanf("%d",&t);
    printf("%d\n",t);
    while(t--)
    {
        ans = 0;
        scanf("%d%s%s%d",&day,s,str,&year);
        ans += day;
        for (i = 1; i <= 19; i ++)
        {
            if (!strcmp(str,Hab[i]))
                break;
        }
        ans += (i-1)*20;
        ans += year*365;
        int t = ans%20+1;
        int d = ans%13+1;
        int y = ans/260;
        printf("%d %s %d\n",d,Tzo[t],y);
    }
    return 0;
}
View Code

 

posted @ 2013-08-02 11:08  N_ll  阅读(172)  评论(0编辑  收藏  举报