http://poj.org/problem?id=1008
题意:
两种历法:
1、Haab,一年365天,共19个月,前18月有20天(编号为0-19),最后一个月有5天(编号为0-4)pop(1月),no(2),zip(3), zotz(4), tzec(5), xul(6), yoxkin(7), mol(8), chen(9), yax(10), zac(11), ceh(12), mac(13), kankin(14), muan(15), pax(16), koyab(17), cumhu(18),uayet(19)
第一年的第一天:0 pop 0
2、Tzolkin ,一年260天,共13个月(编号为1-13),每个月20天,命名为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(14), mem(15), cib(16), caban(17), eznab(18), canac(19), ahau(20)
第一年的第一天:1 imix 0
AC代码:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char a[21][10]={" ","pop", "no", "zip", "zotz", "tzec", "xul",
"yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac",
"kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
char b[20][10]={"imix", "ik", "akbal", "kan", "chicchan",
"cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb",
"ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
int main()
{
int t;
scanf("%d",&t);
printf("%d\n",t);
while(t--)
{
int d,y;
char s[20];
scanf("%d. %s %d",&d,s,&y);
int num=y*365;
int m=0;
for(int i=0;i<20;i++)
{
if(strcmp(a[i],s)==0)
m=i;
}
num+=(m-1)*20;
num+=d;
int yy=num/260;
int mm=num%260%13+1;
int dd=num%20;
printf("%d %s %d\n",mm,b[dd],yy);
}
return 0;
}