-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenDoor.java
More file actions
28 lines (25 loc) · 830 Bytes
/
OpenDoor.java
File metadata and controls
28 lines (25 loc) · 830 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
/**
* Created by MalhotR1 on 04/18/2017.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class OpenDoor {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine().trim());
for (int t = 0; t < T; t++) {
int N = Integer.parseInt(br.readLine().trim());
int[] arr = new int[N];
for (int i = 1; i <= N; i++) {
for (int j = 0; j < N; j++) {
if ((j+1)%i == 0) arr[j] ^= 1;
}
}
for (int i = 0; i < N; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
}
}