/*
火星文有两位,第二位为0不输出
*/
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<ctype.h>
using namespace std;
char arr[20]={0};
char data[13][2][5]={
{"tret","tret"},
{"jan","tam"},
{"feb","hel"},
{"mar","maa"},
{"apr","huh"},
{"may","tou"},
{"jun","kes"},
{"jly","hei"},
{"aug","elo"},
{"sep","syy"},
{"oct","lok"},
{"nov","mer"},
{"dec","jou"}
};
void prr(char *str){
if(str[3]=='t'&&str[0]=='t'&&str[1]=='r'&&str[2]=='e'){
printf("0");return;
}
if(islower(str[0])){//输入为火星文
int high=0,low=0;
for(int i=0;i<13;i++){
if(data[i][1][0]==str[0]&&data[i][1][1]==str[1]&&data[i][1][2]==str[2])//前边的字符只可能是高位
high+=i*13;
if(data[i][0][0]==str[0]&&data[i][0][1]==str[1]&&data[i][0][2]==str[2])//后边的字符不确定
low+=i;
if(data[i][0][0]==str[4]&&data[i][0][1]==str[5]&&data[i][0][2]==str[6]&&str[3]!='\0')
low+=i;
}
printf("%d",low+high);
}
else{//输入为数字
int temp;
sscanf(str,"%d",&temp);
if(temp<13){
printf("%s",&data[temp][0]);
}
else{
printf("%s",&data[temp/13][1]);
if(temp%13!=0)
printf(" %s",&data[temp%13][0]);
}
}
}
int main(){
int N;scanf("%d",&N);
for(int i=0;i<N;i++){
scanf(" %[^\n]",arr);
if(i!=0) printf("\n");
prr(arr);
}
return 0;
}
转载于:https://www.cnblogs.com/hebust/p/9498019.html