그냥 LinkedList 연습 문제다
import java.util.LinkedList;
import java.util.Scanner;
public class swea암호문1 {
static int N, M, x, y, s;
static LinkedList <Integer> al, newAl;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int tc = 1; tc <= 1; tc++) {
//0 ~ 999999까지 니까 integer 가능
al = new LinkedList<Integer>();
N = sc.nextInt();
// 원본 암호문 입력
for (int i = 0; i < N; i++) {
al.add(sc.nextInt());
}
// 명령어의 개수
M = sc.nextInt();
for (int i = 0; i < M; i++) {
newAl = new LinkedList<Integer>();
sc.next(); // I 먹고 버림
x = sc.nextInt();
y = sc.nextInt();
for (int j = 0; j < y; j++) {
newAl.add(sc.nextInt());
}
for (int j = y -1; j >= 0; j--) {
al.add(x, newAl.get(j));
}
}
System.out.print("#" + tc + " ");
for (int i = 0; i < 10; i++) {
System.out.print(al.get(i) + " ");
}
System.out.println();
}
}
}
'알고리즘 문제 풀이' 카테고리의 다른 글
백준 7576 토마토 (Java 자바) (0) | 2021.03.25 |
---|---|
백준 2579 계단 오르기 (Java 자바) (0) | 2021.03.24 |
SWEA 9229 한빈이의 spot mart (Java 자바) (0) | 2021.02.08 |
백준14501 퇴사 (Java 자바) (0) | 2021.02.08 |
백준1158 요세푸스 문제: 자바(수정중) (0) | 2021.02.08 |