SWEA_D3_3499
π [D3_3499] νΌννΈ μ ν
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solution {
static StringTokenizer st;
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int T = Integer.parseInt(br.readLine());
for (int tc = 1; tc <= T; tc++) {
sb.append("#").append(tc).append(" ");
int N = Integer.parseInt(br.readLine());
ArrayList<String> list = new ArrayList<String>();
// μ§μμΈ κ²½μ°
if (N % 2 == 0) {
st = new StringTokenizer(br.readLine(), " ");
for (int i = 0; i < N; i++) {
list.add(st.nextToken());
}
int point = 1;
for (int i = N / 2; i < N; i++) {
String move = list.get(i);
list.remove(i);
list.add(point, move);
point += 2;
}
for (int i = 0; i < N; i++) {
sb.append(list.get(i)).append(" ");
}
sb.append("\n");
}
// νμμΈκ²½μ°
else {
st = new StringTokenizer(br.readLine(), " ");
for (int i = 0; i < N; i++) {
list.add(st.nextToken());
}
int point = 1;
for (int i = N / 2 + 1; i < N; i++) {
String move = list.get(i);
list.remove(i);
list.add(point, move);
point += 2;
}
for (int i = 0; i < N; i++) {
sb.append(list.get(i)).append(" ");
}
sb.append("\n");
}
}
System.out.println(sb);
}
}
π€ λμ μκ°
λ κ°λ‘ λλ μ μ¬μ΄μ¬μ΄μ λ£λ λ¬Έμ μΈλ° , κ°μ₯ μκ°ν΄μΌ ν κ²μ input κ°μκ° μ§μμΈμ§ νμμΈμ§ μ΄λ€.
κ²°κ³Όμ μΌλ‘λ κ·Έλ₯ Nμ λλ μ λκ°μ λΆλΆμΌλ‘ ꡬννμμ§λ§
λ€λ₯Έ κΈ°λ°ν μμ΄λμ΄λ₯Ό μκ°ν΄ λ΄€μ§λ§ .. λμ€μ§ μμλ€.. γ
_γ