-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1044_re_make.cpp
47 lines (45 loc) · 1.18 KB
/
1044_re_make.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
#include <iostream>
#include <string>
using namespace std;
// 测试点1 :输入0,输出 0对应的值。
// 测试点4:输入十进制 13的倍数,不输出 十三进制 第二位 0;
string a[13] = {"tret", "jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep", "oct", "nov", "dec"};
string b[13] = {"####", "tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mer", "jou"};
string s;
int len;
void func1(int t)
{
if (t / 13) cout << b[t / 13];
if ((t / 13) && (t % 13)) cout << " ";
//(t%13==0 说明之后的数据 没有下一位了)
if (t % 13 || t == 0) cout << a[t % 13];
// t!=13的 倍数
}
void func2()
{
int t1 = 0, t2 = 0;
string s1 = s.substr(0, 3), s2;
if (len > 4) s2 = s.substr(4, 3);
for (int j = 1; j <= 12; j++)
{
if (s1 == a[j] || s2 == a[j]) t2 = j;
if (s1 == b[j]) t1 = j;
}
cout << t1 * 13 + t2;
}
int main() {
int n;
cin >> n;
getchar();
for (int i = 0; i < n; i++)
{
getline(cin, s);
len = s.length();
if (s[0] >= '0' && s[0] <= '9')
func1(stoi(s));
else
func2();
cout << endl;
}
return 0;
}