목록분류 전체보기 (123)
남극

Stack 우선 stack이 무엇이냐 하면 사전적 정의로는 쌓아 올린다는 뜻을 가지고 있습니다. 한 방향에서 쌓아 올리는 형태의 자료구조를 뜻합니다. 사진을 보시면 첫 번째 값은 가장 마지막에 저장되어 있는 것을 보실 수 있습니다. 위에 쓰여있듯이 후입 선출의 구조를 가지고 있습니다. 해석하자면 마지막에 들어온 값이 가장 먼저 나간다는 뜻입니다. 가장 먼저 들어온 것이 가장 마지막에 나간다고 보실 수도 있습니다. 이것을 간단하게 LIFO(Last-In-Last-Out)라고 칭합니다. 스택에는 TOP이라는 개념이 있습니다. 이 top이라는 곳으로만 데이터에 접근하도록 제한하는 것입니다. 다른 곳으로는 데이터가 들어오지 않도록 말입니다. Stack 클래스의 계산 push 스택의 탑에 아이템을 삽입 pop 스..

package Baekjoon; import java.util.Scanner; public class Baekjoon2441 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); for (int i = 1; i = i; j--) { System.out.print("*"); } System.out.println(); } } }

package Baekjoon; import java.util.Scanner; public class Baekjoon11654 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int sa = s.charAt(0); System.out.println(sa); sc.close(); } }

package Baekjoon; import java.util.Scanner; public class Baekjoon2440 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); for (int i = 1; i = i; j--) { System.out.print("*"); } System.out.println(); } } }

package Baekjoon; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Baekjoon10833 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int n = toInt(bf.readLine()); int result = 0; for (int i = 0; i < n; i..

package Baekjoon; import java.util.Scanner; public class Baekjoon10797 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int cm = 0; int cnt = 0; for (int i = 0; i < 5; i++) { cm = sc.nextInt(); if (n == cm) { cnt++; } } sc.close(); System.out.println(cnt); } }