#include<iostream>
#include<cstring>
#include<string>
#include<map>
#include<cstdio>
using namespace std;
map<string,int> StrToInt;//映射,str到int
string IntToStr[170];//映射,int到str
string shidigit[13]={"tret","tam","hel","maa","huh","tou","kes","hei","elo","syy","lok","mer","jou"};
string gedigit[13]={"tret","jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep", "oct", "nov", "dec"};
void init()//打表,映射表
{
string str;
for(int i=0;i<13;i++)//一位数字和个位数字为0的两位数字特殊处理
{
IntToStr[i]=gedigit[i];
StrToInt[gedigit[i]]=i;
IntToStr[i*13]=shidigit[i];
StrToInt[shidigit[i]]=i*13;
}
for(int i=1;i<13;i++)//正常两位数字
{
for(int j=1;j<13;j++)
{
str=shidigit[i]+" "+gedigit[j];
IntToStr[i*13+j]=str;
StrToInt[str]=i*13+j;
}
}
}
int main()
{
string in;
init();
//cin>>in;
int n,i,j,num;
//cin>>n;
scanf("%d%*c",&n);//输入行数,忽略换行符,避免被getline读入
for(i=0;i<n;i++)
{
getline(cin,in);//整行读入
num=0;
if(in[0]>='0'&&in[0]<='9')//如果为数字,计算其值并映射
{
for(j=0;j<in.length();j++)
{
num=num*10+(in[j]-'0');
}
cout<<IntToStr[num]<<endl;
}
else//如果为字符串,直接映射
{
cout<<StrToInt[in]<<endl;
}
}
return 0;
}
pat乙1044 火星数字
最新推荐文章于 2022-09-29 08:00:00 发布