-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEncoded_String.cpp
More file actions
51 lines (47 loc) · 851 Bytes
/
Copy pathEncoded_String.cpp
File metadata and controls
51 lines (47 loc) · 851 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
43
44
45
46
47
48
49
50
51
/*
* @Date : 2021-01-04 13:15:10
* @Author : aerma7309
*/
#include <bits/stdc++.h>
using namespace std;
int FastIO = []() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
map<int, char> mp;
void init_map()
{
for (int i = 0; i < 16; i++)
{
int t = i, d = 0, val = 1;
while (t)
d += (t & 1) * val, val <<= 1, t >>= 1;
mp[d] = 'a' + d;
}
}
void solve()
{
int n;
cin >> n;
string ans = "";
for (int i = 0; i < n / 4; i++)
{
int d = 0;
char inp;
for (int j = 0; j < 4; j++)
cin >> inp, d <<= 1, d |= (inp - '0');
ans.push_back(mp[d]);
}
cout << ans << '\n';
}
signed main()
{
init_map();
int t;
cin >> t;
while (t--)
solve();
return 0;
}