fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int d;
  6. cin >> d;
  7. for (int j = 0; j < d; ++j){
  8. int n;
  9. bool w = false;
  10. cin >> n;
  11. for (int i = 0; n>0; ++i){
  12. if (n % 2 == 1){
  13. if(w) cout << " ";
  14. w = true;
  15. cout << i;
  16. }
  17. n /= 2;
  18. }
  19. cout << endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 4444KB
stdin
3
19
228
17
stdout
0 1 4
2 5 6 7
0 4