//题意:玛雅人有两种计算年的,方法1):一年19个月,前18个月20天,弟19个月5天,共365天,每个月有自己的英文代号,天数、年份下标从0开始;方法2):一年分为13个月,每个月20天,共260天,每天有自己的英文代号;给出方法1中的某一天让你转换为方法二的某一天。输入:方法一的的 天数下标. 月份代号 年份下标 输出:数字(从1~13循环输出) 天的英文代号 年份下标(【注意】:这个输出很奇怪要求,第一个数字从1~13循环输出 天的英文代号 年份)
//思路:找到对应规律很简单,然后主要通过map将月份或者天数的代号和数字对应起来,当然注意一个东西,比如今年是弟0年,今年最后一天对应的年份还是0,这里当时wa了一次
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std;
//建立映射用map数组
map <string, int> mp;
map <int, string>mp1;
//初始化数组用map很方便
void init()
{
string s[] = {
"pop", "no", "zip", "zotz", "tzec", "xul",
"yoxkin", "mol", "chen", "yax", "zac", "ceh",
"mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"
};
string s1[] = {
"imix", "ik", "akbal", "kan", "chicchan", "cimi",
"manik", "lamat", "muluk", "ok", "chuen", "eb",
"ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"
};
for(int i = 0; i < 19; i++){
mp[s[i]] = i;
}
int j = 0;
while(j<20){
mp1[j] = s1[j];
j++;
}
return ;
}
int main()
{
int t;
init();
while(scanf("%d", &t) != EOF){
printf("%d\n", t);
getchar();
while(t--){
char str[20];
char c;
int index_dot, second_space, len = 0, day = 0, year = 0;
string s;
//输入
while(1){
scanf("%c", &c);
if(c == '\n')
break;
else if(c == '.')
index_dot = len;
else if(c == ' ')
second_space = len;
str[len++] = c;
}
//将字符串截取获得int 和 字符串
for(int i = 0; i < index_dot; i++){
day = day*10 + (str[i]-'0');
}
for(int i = second_space+1; i < len; i++){
year = year*10 + (str[i]-'0');
}
for(int i = index_dot+2, j = 0; i < second_space; i++,j++){
s += str[i];
}
//计算
int month1, year1, day1, t;
t = year*365 + 20*mp[s] + day + 1;
month1 = t%13 == 0 ? 13 : t%13;
year1 = t%260 == 0 ? t/260-1 : t/260;
day1 = t%20 == 0 ? 19 : t%20-1;
printf("%d ", month1);
cout << mp1[day1] << " ";
printf("%d\n", year1);
}
}
return 0;
}