import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { static int N; static boolean[][] graph; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); int start = sc.nextInt() - 1; int end = sc.nextInt() - 1; graph = new boolean[N][N]; int M = sc.nextInt(); for (int i = 0; i < M; i++) { int s = sc.nextInt() - 1; ..
import java.util.Scanner; public class Main { static int N; //정점의 개수 static int M; //간선의 개수 static boolean visits[]; static boolean map[][]; public static void main(String[] args) { int count = 0; Scanner scan = new Scanner(System.in); N = scan.nextInt(); M = scan.nextInt(); visits = new boolean[N + 1]; map = new boolean[N + 1][N + 1]; for(int i = 1; i
import java.util.*; public class Main{ // 영역 구하기 static int[] dx = {0,1,0,-1}; static int[] dy = {1,0,-1,0}; static int m; static int n; static int k; static boolean[][] visited; static int[][] map; private static void solution () { Scanner sc = new Scanner(System.in); m = sc.nextInt(); n = sc.nextInt(); k = sc.nextInt(); map = new int[m][n]; visited = new boolean[m][n]; int count = 0; ArrayList..
HashSet은 Set인터페이스의 구현 클래스. Set -객체를 중복해서 저장할 수 없고, 하나의 null값만 저장 -저장 순서가 없다 (index 없음) HashSet선언 HashSet set = new HashSet(); // HashSet 생성 set.add(1) // 값 추가 -->입력되는 값이 HashSet 내부에 존재하지 않는다면 그 값을 HashSet에 추가하고, true를 반환한다 -->내부에 값이 존재한다면 false를 반환한다. HashSet값 삭제 HashSet set = new HashSet(Arrays.asList(1,2,3)); set.remove(1)//값1을 삭제한다 set.clear();//모든 값 삭제 HashSet크기 구하기 set.size(); HashSet 값 출력 ..