-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path이진수.java
More file actions
38 lines (29 loc) · 920 Bytes
/
이진수.java
File metadata and controls
38 lines (29 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 이진수
import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int T = Integer.parseInt(br.readLine());
int res = 0;
for (int i = 0; i < T; i++) {
int n = Integer.parseInt(br.readLine());
List<Integer> positions = new ArrayList<>();
int pos = 0;
while (n > 0) {
if (n % 2 == 1) {
positions.add(pos);
}
pos++;
n /= 2;
}
for (int j : positions) {
sb.append(j).append(" ");
}
sb.append("\n");
}
System.out.println(sb);
}
}