模拟题,难度不大,主要是吃透题目意思
主要做好表示月份的单词与相应序号的转换,我用的是数组+索引函数
Haab日历, 一年365天, 19个月,每个月20天, 通过输入可求得总天数sum
T日历, 一年260 = 20 * 13天, 对sum%260的结果分别对20, 13取模定位到哪月哪天
废话不多说,上代码~
#include<iostream>
#include<string>
using namespace std;
string Haab_Tab[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
string Holly_Tab[] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
int H_find(string s)
{
for(int i = 0; i < 19; i++)
if(Haab_Tab[i] == s)
return i;
}
int main()
{
int n, times = 0;
cin >> n;
cout << n << endl;
while(times < n)
{
times++;
float hx;
string hy;
int hz, sum, tx, tz, ty;
cin >> hx >> hy >> hz;
sum = 365*hz + H_find(hy)*20 + (int)hx;
tz = sum / 260;
sum %= 260;
ty = sum % 20;
tx = sum % 13;
cout << tx+1 << ' ' << Holly_Tab[ty] << ' ' << tz << endl;
}
return 0;
}