细心点写,应分为 0 13的倍数 1到12 >13非13倍数 来考虑情况 否则很容易漏
#include<iostream>
using namespace std;
string word[2][13]=
{
{"tret","jan","feb","mar","apr","may","jun","jly","aug","sep","oct","nov","dec"},
{"tret","tam","hel","maa","huh","tou","kes","hei","elo","syy","lok","mer","jou"}
};
int main(){
int N;
cin>>N;
getchar();
for(int i=0;i<N;i++){
string x;
getline(cin,x);
if('0'<=x[0]&&x[0]<='9'){
int n=stoi(x);
if(n%13==0){
cout<<word[1][n/13];
}else if(n>13){
cout<<word[1][n/13]<<" "<<word[0][n%13];
}else{
cout<<word[0][n];
}
}else{
if(x=="tret"){
printf("0");
}else if(x.length()==3){
for(int j=1;j<13;j++){
if(x==word[0][j]){
cout<<j;
break;
}
if(x==word[1][j]){
cout<<j*13;
break;
}
}
}else{
int ans=0;
for(int j=1;j<13;j++){
if(x.substr(0,3)==word[1][j]){
ans+=j*13;
}
if(x.substr(4,6)==word[0][j]){
ans+=j;
}
}
cout<<ans;
}
}
cout<<endl;
}
return 0;
}