题解 | #压缩二维码#(输入输出)
压缩二维码
https://www.nowcoder.com/practice/1150d36c2cd64df9bf373988486c6723
分析:
就是一个输入字符串
然后没四位输出一个答案就行了
代码
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl "\n"
#define PII pair<int,int>
#define PIII pair<int,PII>
const int MOD = 1e9 + 7;
const int N = 3e5;
void slu() {
int n;
cin >> n;
n = pow(2, n);
string t;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
char temp;
cin >> temp;
t.push_back(temp);
}
}
int res = 0;
for (int i = 0, j = 3; i < t.size(); i++, j--) {
if (t[i] == '#')res += pow(2, j);
if (j == 0) {
j = 4;
cout << res << " ";
res = 0;
}
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T;
// cin >> T;
T = 1;
while (T--)slu();
}