-
Notifications
You must be signed in to change notification settings - Fork 2
/
B1044.cpp
52 lines (48 loc) · 1.09 KB
/
B1044.cpp
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
#include <string>
#include <iostream>
#include <map>
using namespace std;
int N;
const string low[13] = {"tret", "jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep", "oct", "nov", "dec"};
const string high[13] = {"tret", "tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mer", "jou"};
map<string, int> strToInt;
map<int, string> intToStr;
void init(){
for(int i = 0; i < 13; ++i){
strToInt[low[i]] = i;
strToInt[high[i]]= i * 13;
intToStr[i] = low[i];
intToStr[i*13] = high[i];
}
for(int i = 1; i < 13; ++i){
for(int j = 1; j < 13; ++j){
string temp = high[i] + " " + low[j];
strToInt[temp] = i*13 + j;
intToStr[i*13+j] = temp;
}
}
}
int transfer(const string &str){
int num = 0;
for(int i = 0; i < str.length(); ++i){
num = num * 10 + str[i] - '0';
}
return num;
}
int main(){
init();
int num;
string str;
cin >> N;
getline(cin, str);
for(int i = 0; i < N; ++i){
getline(cin, str);
if(str[0] >= '0' && str[0] <= '9'){
num = transfer(str);
cout << intToStr[num] << endl;
}else{
cout << strToInt[str] << endl;
}
}
return 0;
}