250x250
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 |
Tags
- 주사위굴리기2
- 백준2251
- 코테준비
- 파티션 크기 조정
- 자바
- 재귀함수
- 중복조합
- 에라토스테네스의채
- 알고리즘개념
- 완전탐색
- 순열
- 코테
- 정올 1620
- 완탐
- 볼륨 만들기
- 23288
- N과M
- BFS
- 백준13458
- 삼성역테
- 백준
- 백준15652
- 전화번호속의암호
- 알고리즘
- 정보처리기사
- java
- D드라이브생성
- 자바 코테
- 중복순열
- Bfs와DFS
Archives
- Today
- Total
뚱땅뚱땅
[문제] SWEA 1228번 암호문1 본문
728x90
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
내 풀이
LinkedList 를 이용하여 풀면 쉽게 풀리는 문제다.
입력 부분이 좀 복잡하므로 이 부분만 주의하면 될 듯 하다.
public class Solution {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
StringTokenizer st;
int T = 10;
for(int tc=1;tc<= T;tc++) {
sb.append("#").append(tc).append(" ");
LinkedList<Integer> list = new LinkedList<>();
int N = Integer.parseInt(in.readLine()); // 암호문 길이
String s[] = in.readLine().split(" "); // 암호문 N개
for(int i=0;i<N;i++) {
list.add(Integer.parseInt(s[i]));
}
int I = Integer.parseInt(in.readLine()); // 명령어 개수
String inst = in.readLine(); // 명령어
st = new StringTokenizer(inst, " ");
for(int i=0;i<I;i++) {
String instI = st.nextToken(); //명령어 I
int x = Integer.parseInt(st.nextToken()); //위치
int y = Integer.parseInt(st.nextToken()); //삽입 개수
for(int j=0;j<y;j++) {
int add = Integer.parseInt(st.nextToken());
list.add(x+j, add);
}
}
for(int i=0;i<10;i++) {
sb.append(list.get(i)).append(" ");
}
sb.append("\n");
}
System.out.println(sb);
}
}
728x90
'알고리즘 > swea' 카테고리의 다른 글
[문제]SWEA 8382 방향전환 (0) | 2021.03.05 |
---|---|
[문제] SWEA 6808번 규영이와 인영이의 카드게임 (0) | 2021.02.15 |
[문제] SWEA 5215번 햄버거 다이어트 (0) | 2021.02.08 |
[문제] SWEA 1861번 정사각형 방 (0) | 2021.02.07 |
[문제] SWEA 3499번 퍼펙트 셔플 (0) | 2021.02.05 |
Comments