voidsolve() { int n; cin >> n; for (int i = 1; i <= n; i ++) cin >> a[i]; for (int i = 1; i <= n; i++) { int x = a[i]; while (x - lowbit(x)) x -= lowbit(x); // 不断减去次位的 1 cout << x << " \n"[i == n]; // 输出剩下的 x,i == n 时候自动换行 } }
signedmain() { // ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int T; cin >> T; while (T --) solve(); return0; }