Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 38959 | Accepted: 11859 |
此题的思路就是将Haab日历格式转化成天数,然后再将天数转化成Tzolkin格式,但是这里有几点需要注意,一个就是很多人容易将Haab的第十九月给忘记了,第二个就是当“天数”%260==0时,表名是本年的最后一天,此时不能用“天数”/260,而是应该再减一。
代码:
1 #include<stdio.h>
2 #include<string.h>
3 int main()
4 {
5
6 char map[19][10]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
7 char map2[20][10]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
8 int n,d,y,i,mo,s,num;
9 char m[10];
10 scanf("%d",&n);
11 printf("%d\n",n);
12 while(n--)
13 {
14 scanf("%d.",&d);
15 scanf("%s",m);
16 scanf("%d",&y);
17 for(i=0;i<20;i++)
18 {
19 if(strcmp(m,map[i])==0)
20 {
21 mo=i;
22 break;
23 }
24 }
25 s=y*365+mo*20+d;
26 y=s/260;
27 num=(s+1)%260%13;
28 if(num==0)
29 num=13;
30 d=(s+1)%260%20-1;
31 if(d==-1)
32 d=19;
33 printf("%d %s %d\n",num,map2[d],y);
34 }
35
36 return 0;
37 }
38
39
40 /*
41 4. uayet 259
42 正解是 13 ahau 364
43 而不是13 ahau 365
44 3
45 10. zac 0
46 0. pop 0
47 10. zac 1995
48 */