-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4848.cpp
More file actions
42 lines (34 loc) · 789 Bytes
/
4848.cpp
File metadata and controls
42 lines (34 loc) · 789 Bytes
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
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include <string>
using namespace std;
string arr[16];
string join(string a) {
string temp = a;
temp[temp.size() - 1] = ',';
temp += a;
temp += "}";
return temp;
}
int main() {
ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
arr[0] = "{}";
arr[1] = "{{}}";
for (int i = 2; i < 16; i++) {
arr[i] = join(arr[i - 1]);
}
int T;
cin >> T;
while (T--) {
string a, b;
cin >> a >> b;
int anum, bnum;
for (int i = 0; i < 16; i++) {
if (arr[i] == a)anum = i;
if (arr[i] == b)bnum = i;
}
cout << arr[anum + bnum] << '\n';
}
}