火星文两位的时候,个位的0不需要,小坑。(代码好烂,时间久了,已经不想看了,也不想改了)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
char s1[20][10] = { "tret","jan","feb","mar","apr","may",
"jun","jly","aug","sep","oct","nov","dec" };
char s2[20][10] = { "0","tam","hel","maa","huh","tou","kes",
"hei","elo","syy","lok","mer","jou" };
char s[10];
int main()
{
int n;
char c;
scanf("%d", &n);
scanf("%c", &c);
for (int i = 1; i <= n; i++)
{
gets(s);
int a = 0;
int l = strlen(s);
if (s[0] >= '0'&&s[0] <= '9')
{
for (int j = 0; j<l; j++)
{
a = a * 10 + (s[j] - '0');
}
if (a<13)
printf("%s\n", s1[a]);
else if(a%13==0)
printf("%s\n", s2[a / 13 % 13]);
else
printf("%s %s\n", s2[a / 13 % 13], s1[a % 13]);
}
else
{
if (s1[0][0] == s[0] && s1[0][1] == s[1] && s1[0][2] == s[2] && s1[0][3] == s[3])
a = 0;
for (int j = 1; j<13; j++)
{
if (s1[j][0] == s[0] && s1[j][1] == s[1] && s1[j][2] == s[2])
a = j;
}
for (int j = 1; j<13; j++)
{
if (s2[j][0] == s[0] && s2[j][1] == s[1] && s2[j][2] == s[2])
a = j * 13;
}
if (l>3)
{
if (s1[0][0] == s[0] && s1[0][1] == s[1] && s1[0][2] == s[2] && s1[0][3] == s[3])
a = 0;
for (int j = 1; j<13; j++)
{
if (s1[j][0] == s[4] && s1[j][1] == s[5] && s1[j][2] == s[6])
a = a + j;
}
}
cout << a << endl;
}
}
return 0;
}