POJ1008
Problem: 1008 | User: wjinkun | |
Memory: 388K | Time: 0MS | |
Language: GCC | Result: Accepted |
一开始把Haab的最后一个月落下了,(⊙o⊙)。。。
1 #include <stdio.h>
2 #include <string.h>
3 int main()
4 {
5 char Tzolkin[20][9]= {{"imix"},{"ik"},{"akbal"},{"kan"},{"chicchan"},{"cimi"},{"manik"},{"lamat"},{"muluk"},{"ok"},{"chuen"},{"eb"},{"ben"},{"ix"},{"mem"},{"cib"},{"caban"},{"eznab"},{"canac"},{"ahau"}};
6 char Haab[19][7]= {{"pop"},{"no"},{"zip"},{"zotz"},{"tzec"},{"xul"},{"yoxkin"},{"mol"},{"chen"},{"yax"},{"zac"},{"ceh"},{"mac"},{"kankin"},{"muan"},{"pax"},{"koyab"},{"cumhu"},{"uayet"}};
7 int n,Haab_day,Haab_year,day,Tzolkin_year,Tzolkin_number,Tzolkin_name,i,j;
8 char Haab_month[7];
9 scanf("%d",&n);
10 printf("%d\n",n);
11 for(i=1;i<=n;i++)
12 {
13 scanf("%d. %s %d",&Haab_day,Haab_month,&Haab_year);
14 j=0;
15 while(strcmp(Haab[j],Haab_month))
16 j++;
17 day=j*20+Haab_day+Haab_year*365;
18 Tzolkin_year=day/260;
19 Tzolkin_number=day%260%13+1;
20 Tzolkin_name=day%260%20;
21 printf("%d %s %d\n",Tzolkin_number,Tzolkin[Tzolkin_name],Tzolkin_year);
22 }
23 return 0;
24 }