http://acm.pku.edu.cn/JudgeOnline/problem?id=1008
1#include<stdio.h>
2#include<string.h>
3int main()
4{
5 const char Haab_m[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax",
6 "zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
7 const char Tzolkin_d[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok",
8 "chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
9 int i,n,Day,Year,total_d;
10 int Y,Di,M,tem_d;
11 char Month[10];
12 scanf("%d",&n);
13 printf("%d\n",n);
14 while((n--)>0){
15 scanf("%d. %s %d",&Day,&Month,&Year);
16 total_d=365*Year;
17 for(i=0;i<19;i++)
18 if(strcmp(Month,Haab_m[i])==0){
19 total_d+=Day+1;
20 break;}
21 else total_d+=20;
22 if(i==19)total_d+=Day+1;
23 tem_d=total_d%260;
24 if(!tem_d){
25 Y=total_d/260-1;
26 M=13;
27 Di=19;}
28 else {
29 Y=total_d/260;
30 M=tem_d%13;
31 Di=(tem_d+19)%20;
32 if(!M)M=13;}
33 printf("%d %s %d\n",M,Tzolkin_d[Di],Y);
34 }
35 return 0;
36}
posted on 2008-02-25 19:33
zoyi 阅读(488)
评论(0) 编辑 收藏 引用 所属分类:
acm