[๋ฐฑ์ค€ 2161] ์นด๋“œ1 | ์ž๋ฐ”
ยท
๐Ÿ“ Coding Test/๋ฐฑ์ค€ Sliver
๋ฌธ์ œ์นด๋“œ1ํ’€์ด 1import java.util.*;class Main { static int n; static Queue q; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); q = new LinkedList(); for(int i = 1; i ์ฒซ ํ’€์ด ๋•Œ NullPointer ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ด try-catch๋กœ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.ํ’€์ด 2import java.util.*;class Main { static int n; static Queue q; public static void main(String[] args) { Scanner sc = ne..
[๋ฐฑ์ค€ 1260] DFS์™€ BFS | ์ž๋ฐ”
ยท
๐Ÿ“ Coding Test/๋ฐฑ์ค€ Sliver
๋ฌธ์ œDFS์™€ BFSํ’€์ดimport java.util.*;class Main { static int n; static int m; static int v; static boolean[] visited; static ArrayList> graph; static void dfs(int x) { visited[x] = true; System.out.print(x + " "); for(int next : graph.get(x)) { if(!visited[next]) { visited[next] = true; dfs(next); } } } static void bfs(int start) { Queue q = new LinkedLis..
[๋ฐฑ์ค€ 2805] ๋‚˜๋ฌด ์ž๋ฅด๊ธฐ | ์ž๋ฐ”
ยท
๐Ÿ“ Coding Test/๋ฐฑ์ค€ Sliver
๋ฌธ์ œ๋‚˜๋ฌด ์ž๋ฅด๊ธฐ์ •๋‹ตimport java.util.*;class Main { static int n; // ๋‚˜๋ฌด์˜ ์ˆ˜ static int m; // ๊ฐ€์ ธ ๊ฐ€๋ ค๋Š” ๊ธธ์ด static int[] arr; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); arr = new int[n]; for (int i = 0; i mid) sum += arr[i] - mid; } if(sum >= m) { answer = mid; left = mid + 1; } else { ..