-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSolution.java
31 lines (24 loc) Β· 937 Bytes
/
Solution.java
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
package Iterations.swea3499;
import java.io.*;
public class Solution {
static int T, N;
public static void main(String[] args) throws Exception {
System.setIn(new FileInputStream("src/Iterations/swea3499/sample_input.txt"));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
T = Integer.parseInt(br.readLine());
for (int t = 1; t <= T; t++) {
sb.append("#").append(t).append(" ");
N = Integer.parseInt(br.readLine());
String[] card = br.readLine().split(" ");
int N_ = N;
if (N%2 == 1) N_++;
for (int i = 0; i < N_/2; i++) {
sb.append(card[i]).append(" ");
if (N_/2+i < N) sb.append(card[N_/2+i]).append(" ");
}
sb.append("\n");
}
System.out.println(sb.toString());
}
}