java
암호문을 수정해야 하는데, 이 암호문은 특수 제작된 처리기로만 수정이 가능하다.
이 처리기는 다음과 같이 1개의 기능을 제공한다.
암호문을 수정하고, 수정된 결과의 처음 10개 숫자를 출력하는 문제
LinkedList 를 이용해 문제를 해결하였다.
LinkedList 로 쉽게 해결한 문제이다. LinkedList 를 활용한 다른 문제들도 많이 풀어 볼 계획이다.
import java.util.Scanner;
import java.io.FileInputStream;
import java.util.LinkedList;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
for(int test_case = 1; test_case <= 10; test_case++)
{
int N = sc.nextInt();
LinkedList<Integer> list = new LinkedList<>();
for (int i = 0; i < N; i++) {
list.add(sc.nextInt());
}
int M = sc.nextInt();
for (int i = 0; i < M; i++) {
String I = sc.next();
int x = sc.nextInt();
int y = sc.nextInt();
for (int j = 0; j < y; j++) {
list.add(x+j, sc.nextInt());
}
}
System.out.print("#" + test_case);
for (int i = 0; i < 10; i++) {
System.out.print(" " + list.get(i));
}
System.out.println();
}
}
}
JavaReadable Code: 읽기 좋은 코드를 작성하는 사고법Practical Testing: 실용적인 테스트 가이드 강의와 함께한 인프런 워밍업 클럽…
Readable Code: 읽기 좋은 코드를 작성하는 사고법Practical Testing: 실용적인 테스트 가이드 강의와 함께한 인프런 워밍업 클럽…
테스트 시 의존성 주입(Dependency Injection)과 Mockito Spring 애플리케이션을 개발하다 보면, 테스트 코드에서 실제 빈(Bean)을 사용하지…
들어가며 스프링 기반 프로젝트에서 좋은 설계 구조와 테스트 전략은 소프트웨어 품질과 유지보수성에 직결됩니다. 최근 학습한…
Readable Code: 읽기 좋은 코드를 작성하는 사고법Practical Testing: 실용적인 테스트 가이드 강의와 함께한 인프런 워밍업 클럽…
Readable Code: 읽기 좋은 코드를 작성하는 사고법Practical Testing: 실용적인 테스트 가이드 강의와 함께한 인프런 워밍업 클럽…