常规进制转换题
#include <iostream> #include <queue> #include <map> #include <set> #include <cmath> #include <cstring> #include <algorithm> #include <iomanip> #include <stack> #include <numeric> #include <ctime> #include <string> #include <bitset> #include <unordered_map> #include <unordered_set> using namespace std; using ll = long long; const ll N = 1e5 + 5, mod = 1e9 + 7, inf = 0x3f3f3f3f; int n; void solve() { cin >> n; n = pow(2, n) * pow(2, n); char x; int ans = 0, j = 0; for (int i = 0; i < n; i++) { cin >> x; ans = ans * 2 + (x == '#'); j++; if (j == 4) { j = 0; cout << ans << " "; ans = 0; } } } int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t = 1; //cin>>t; while (t--) { solve(); } return 0; }