-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3460.java
More file actions
23 lines (22 loc) · 796 Bytes
/
3460.java
File metadata and controls
23 lines (22 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
/* Integer.toBinaryString() 사용하기 */
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int t = Integer.parseInt(br.readLine());
for(int i=0; i<t; i++){
int n = Integer.parseInt(br.readLine());
String binary = Integer.toBinaryString(n);
for(int j=binary.length()-1; j>=0; j--){
if(binary.charAt(j)=='1'){
sb.append(binary.length()-1-j + " ");
}
}
sb.append('\n');
}
System.out.println(sb);
}
}