1228 SWExpert 암호문1

2020. 2. 6. 17:14Learn/Algorithm

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
39
40
41
import java.util.Scanner;
 
public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int testcase = 10;
        for(int tc = 1; tc <= testcase; tc++) {
            LinkedList <Integer> list = new LinkedList<>();
            int N = sc.nextInt();
            int a = 0;
            int index = 0;
            int num = 0;
            int num2 = 0;
            int sut = 0;
            for(int i = 0; i < N; i++) {
                a = sc.nextInt();
                list.add(a);
            }
            N = sc.nextInt();
            for(int j = 0; j < N; j++) {
                String c = sc.next();
                if(c.charAt(0== 'I') {
                    index = sc.nextInt();
                    num = sc.nextInt();
                    num2 = index;
                    for(int i = 0; i < num; i++) {
                        sut = sc.nextInt();
                        list.add(num2++, sut);
                    }
                }
            }
            System.out.print("#" + tc + " ");
            for(int i = 0; i < 10; i++)
                System.out.print(list.get(i) + " ");
            System.out.println();
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

LinkedList 로 풀면 쉬운문제

'Learn > Algorithm' 카테고리의 다른 글

14501번 퇴사코드 - DP  (0) 2020.02.07
1244 스위치 켜고 끄기 - 재귀연습  (0) 2020.02.07
6603번 로또 - 백트레킹  (0) 2020.02.06
14888 연산자 끼워넣기 - 완전탐색,백트래킹  (0) 2020.02.06
1225 암호생성기  (0) 2020.02.05