1. 题目
2. 代码
2.1 分析
题目本身不难。只是需要处理的判断逻辑还是比较多的。
特别注意:13 ==> 火星文 是tam, 而不是tam tret
26 ==> 火星文 是hel, 而不是hel tret
能整除13的时候,低位的tret不输出。
2.2 代码
low = ['tret','jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jly', 'aug', 'sep', 'oct', 'nov', 'dec']
high = ['tret','tam', 'hel', 'maa', 'huh', 'tou', 'kes', 'hei', 'elo', 'syy', 'lok', 'mer', 'jou']
def to_huoxing(x):
if x < 13:
return low[x]
elif x % 13 == 0:
# 火星人,当高位上有数字的时候,低位不说0
return high[x//13]
else:
return high[x//13] + " " + low[x%13]
def to_number(x):
l = x.split(" ")
if len(l) == 2:
# 两位
i_high = high.index(l[0])
i_low = low.index(l[1])
return i_high * 13 + i_low
# 1位
i = l[0]
if i in low:
return low.index(i)
else:
return high.index(l[0])*13
def main(n):
if '0' <= n[0] and n[0] <= '9':
n = int(n)
print(to_huoxing(n))
else:
print(to_number(n))
x = int(input())
for i in range(x):
s = input()
main(s)