https://pintia.cn/problem-sets/994805260223102976/problems/994805279328157696
测试点34不过,没找到原因
#include #include #include using namespace std; int main(){ string s1[13] = { "tret" ,"jan", "feb", "mar","apr","may", "jun", "jly","aug", "sep", "oct", "nov","dec" }, s2[13] = { "tret","tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mer", "jou" } ,tmps; map g, s; g["jan"] = 1, g["feb"] = 2, g["mar"] = 3, g["apr"] = 4, g["may"] = 5, g["jun"] = 6, g["jly"] = 7, g["aug"]= 8, g["sep"] = 9, g["oct"] = 10, g["nov"] = 11, g["dec"] = 12; s["tam"] = 1, s["hel"] = 2, s["maa"] = 3, s["huh"] = 4, s["tou"] = 5, s["kes"] = 6, s["hei"] = 7, s["elo"] = 8, s["syy"] = 9, s["lok"] = 10, s["mer"] = 11, s["jou"] = 12; int n; cin >> n; getchar(); for(int i = 0; i < n; i++){ getline(cin, tmps); //地球文 if(tmps[0] >= '0' && tmps[0] <= '9'){ int tmp1 = 0, shiwei, gewei; for(int j = 0; j < tmps.size(); j++) tmp1 = 10*tmp1 + tmps[j] - '0'; shiwei = tmp1 / 13; gewei = tmp1 % 13; if(shiwei && gewei) cout << s2[shiwei] << " " << s1[gewei] << endl; else if(shiwei && !gewei) cout << s2[shiwei] << endl; else cout << s1[gewei] << endl; }else{//火星文 string s3 = "", s4 = ""; s3 = s3 + tmps[0]+tmps[1]+tmps[2]; if(tmps.size() > 4){ s4 = s4 + tmps[4]+tmps[5]+tmps[6]; cout << g[s4] + s[s3]*13 << endl; } else cout << g[s3] + s[s3]*13 << endl; } } return 0; }