进制转换和字符串
13->tam(不是tam tret),余数为0时后面的tret不加。
#include <bits/stdc++.h>
using namespace std;
vector<string> s1={"","tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mer", "jou"};
vector<string> s2={"tret","jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep", "oct", "nov", "dec"};
void toMars(int num){
int d1=num/13,d2=num%13;
string res;
res+=s1[d1];
if(d1!=0&&d2==0);
else if(d1!=0&&d2!=0){
res+=" ";
res+=s2[d2];
}else res+=s2[d2];
printf("%s\n",res.c_str());
}
void todig(string s){
if(s.size()<=4){
auto idx=find(s2.begin(),s2.end(),s)-s2.begin();
if(idx==13)idx=(find(s1.begin(),s1.end(),s)-s1.begin())*13;
printf("%d\n",idx);
}else {
string d1=s.substr(0,3),d2=s.substr(4);
auto id1=find(s1.begin(),s1.end(),d1)-s1.begin();
auto id2=find(s2.begin(),s2.end(),d2)-s2.begin();
printf("%d\n",id1*13+id2);
}
}
int main(){
int n;
scanf("%d\n",&n);
for(int i=0;i<n;i++){
string s;
getline(cin,s);
if(s[0]>='0'&&s[0]<='9'){
int num=stoi(s);
toMars(num);
}else todig(s);
}
}