[백준] 201 - 자료구조 1 (연습) : 오큰수 (17298번 JAVA) [중첩 for 문을 사용한 풀이] import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Stack; import java.util.StringTokenizer; public class Main{ public static int[] arr; public static Stack stack = new Stack(); public static int N; public static..
전체 글
[백준] 201 - 자료구조 1 (연습) : 쇠막대기 (10799번) [풀이 방법] import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Stack; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter b..
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Stack; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(S..
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main{ public static int[] deque = new int[10000]; // 0~9999 public static int front = 0; public static int rear = 0; public static int size = 0; // 덱에 들어있는 원소 수 public static void main(String[..
[문제 이해] 큐에 대한 설명 import java.io.IOException; import java.util.LinkedList; import java.util.Queue; public class Main{ public static void main(String[] args) throws IOException{ // '정수'형을 원소로 하는 큐 생성 Queue queue = new LinkedList(); // add() : 큐에 원소 삽입 queue.add(1); queue.add(2); queue.add(3); // 원소 삽입이 이상없는 경우 'true' 반환 System.out.println(queue.add(4)); /* 출력값 true */ // 현재 큐 : // peek() : 큐의 첫번째 ..
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main{ public static int[] queue; public static int rear = -1; // 후단 (삽입 위치) public static int front = -1; // 전단 (삭제 부위) public static void main(String[] args) throws IOException{ BufferedReade..