fork download
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
  9. String[] params1 = bufferedReader.readLine().split(" ");
  10. int d;
  11. d = Integer.parseInt(params1[0]);
  12. for (int j = 0; j < d; ++j){
  13. String[] params2 = bufferedReader.readLine().split(" ");
  14. int n;
  15. boolean w = false;
  16. n = Integer.parseInt(params2[0]);
  17. for (int i = 0; n>0; ++i){
  18. if (n % 2 == 1){
  19. if(w){
  20. System.out.print(" ");
  21. }
  22. w = true;
  23. System.out.print(i);
  24. }
  25. n /= 2;
  26. }
  27. System.out.print("\n");
  28. }
  29. }
  30. }
Success #stdin #stdout 0.04s 2184192KB
stdin
3
17
7
5
stdout
0 4
0 1 2
0 2