1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| #include <cstring> #include <cstdio> #include <map> #include <iostream> #include <string>
using namespace std; map<int, string> ge = {{0, "tret"}, {1, "jan"}, {2, "feb"}, {3, "mar"}, {4, "apr"}, {5, "may"}, {6, "jun"}, {7, "jly"}, {8, "aug"}, {9, "sep"}, {10, "oct"}, {11, "nov"}, {12, "dec"}}; map<int, string> shi = {{1, "tam"}, {2, "hel"}, {3, "maa"}, {4, "huh"}, {5, "tou"}, {6, "kes"}, {7, "hei"}, {8, "elo"}, {9, "syy"}, {10, "lok"}, {11, "mer"}, {12, "jou"}}; map<string, int> shi2 = {{"tam", 1}, {"hel", 2}, {"maa", 3}, {"huh", 4}, {"tou", 5}, {"kes", 6}, {"hei", 7}, {"elo", 8}, {"syy", 9}, {"lok", 10}, {"mer", 11}, {"jou", 12}}; map<string, int> ge2 = {{"tret", 0}, {"jan", 1}, {"feb", 2}, {"mar", 3}, {"apr", 4}, {"may", 5}, {"jun", 6}, {"jly", 7}, {"aug", 8}, {"sep", 9}, {"oct", 10}, {"nov", 11}, {"dec", 12}};
void tenTo13(int x) { int sh = x / 13; if (sh != 0) { int gew = x % 13; if (gew != 0) { printf("%s %s\n", shi[sh].c_str(),ge[gew].c_str()); }else{ printf("%s\n",shi[sh].c_str()); } } else { sh = x % 13; printf("%s\n", ge[sh].c_str()); }
}
int main() { int n; string s, s1, s2; scanf("%d", &n); getchar(); for (int i = 0; i < n; i++) { getline(cin, s); if (isdigit(s[0])) { tenTo13(stoi(s)); } else { int len = s.length(); if (len == 3) { if (ge2.count(s) != 0) printf("%d\n", ge2[s]); else printf("%d\n", shi2[s] * 13); } else if (len == 4) { printf("0\n"); } else { s1 = s.substr(0, 3); s2 = s.substr(4); printf("%d\n", shi2[s1] * 13 + ge2[s2]); } } }
return 0; }
|