Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- binary search
- 이분탐색
- BFS
- 문제풀이
- db
- greedy
- 알고리즘
- 코테
- COS PRO
- MySQL
- 문자열
- 문제해결
- 러닝일지
- oracle
- 운동기록
- dfs
- priorityqueue
- SWEA
- Java
- BOJ
- 자바
- 시뮬레이션
- 백준
- 코딩테스트
- 투포인터
- 프로그래머스
- SQL
- math
- 건강
- DP
Archives
- Today
- Total
슈콩
[SWEA] 8일차 - 암호문2 본문

[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14yIsqAHYCFAYD
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[소스 코드]
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
for(int tc=1;tc<=10;tc++) {
List<Integer> list = new LinkedList<>();
int n = Integer.parseInt(br.readLine());
st = new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) {
list.add(Integer.parseInt(st.nextToken()));
}
int cmd = Integer.parseInt(br.readLine());
st = new StringTokenizer(br.readLine());
for(int i=0;i<cmd;i++) {
String c = st.nextToken();
if(c.equals("I")) {
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
for(int j=0;j<y;j++) {
int val = Integer.parseInt(st.nextToken());
list.add(x++,val);
}
}
else {
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
for(int j=0;j<y;j++) {
list.remove(x);
}
}
}
System.out.print("#"+tc+" ");
for(int i=0;i<10;i++) {
System.out.print(list.get(i)+" ");
}
System.out.println();
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 구독자 전쟁 (0) | 2025.11.17 |
|---|---|
| [SWEA] XY 문자열 1 (0) | 2025.11.17 |
| [SWEA] 영준이와 신비한 뿔의 숲 (0) | 2025.11.17 |
| [SWEA] 두문자어 (0) | 2025.11.17 |
| [SWEA] 시험 (0) | 2025.11.17 |