Notice
Recent Posts
Recent Comments
Link
«   2024/11   »
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
Tags
more
Archives
Today
Total
관리 메뉴

코드와이

[SW Expert Academy] 1228. 암호문1 본문

SW_Expert

[SW Expert Academy] 1228. 암호문1

코드와이 2021. 2. 10. 10:27

 

문제링크

swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14w-rKAHACFAYD&

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

package D3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class 암호문1 {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		StringBuilder sb = new StringBuilder();
		
		for(int tc = 1 ; tc <= 10 ; tc++) {
			sb.append("#" + tc + " ");
			
			LinkedList<String> list = new LinkedList<String>();
			
			int n = Integer.parseInt(br.readLine());
			st = new StringTokenizer(br.readLine(), " ");
			for(int i = 0 ; i < n ; i++) {
				list.offer(st.nextToken());
			}
			
			br.readLine();
			String[] str = br.readLine().split("I");
			
			for(int i = 1 ; i < str.length ; i++) {
				int x = Integer.parseInt(str[i].split(" ")[1]);
				int y = Integer.parseInt(str[i].split(" ")[2]);
				for(int j = 0 ; j < y ; j++) {
					list.add(x + j, str[i].split(" ")[3+j]);
				}
			}
			
			for(int i = 0 ; i < 10 ; i++) {
				sb.append(list.get(i) + " ");
			}
			System.out.println(sb);
			sb.setLength(0);
			
		}
	}
}