동식이 취업시키기 작전/코딩테스트

문제 https://www.acmicpc.net/problem/2667 2667번: 단지번호붙이기 과 같이 정사각형 모양의 지도가 있다. 1은 집이 있는 곳을, 0은 집이 없는 곳을 나타낸다. 철수는 이 지도를 가지고 연결된 집의 모임인 단지를 정의하고, 단지에 번호를 붙이려 한다. 여 www.acmicpc.net 코드 using System; using System.Collections.Generic; class Dongsik { static int n; static int[,] map; static bool[,] visited; static int[] dy = {1, -1, 0, 0}; // 좌표 static int[] dx = {0, 0, -1, 1}; // 좌표 static void Main(st..
문제 https://www.acmicpc.net/problem/2606 2606번: 바이러스 첫째 줄에는 컴퓨터의 수가 주어진다. 컴퓨터의 수는 100 이하인 양의 정수이고 각 컴퓨터에는 1번 부터 차례대로 번호가 매겨진다. 둘째 줄에는 네트워크 상에서 직접 연결되어 있는 컴퓨터 쌍 www.acmicpc.net 코드 using System; class Algorithm { static int n, m; static List[] computers; static bool[] visited; static void Main(string[] arg) { int n = int.Parse(Console.ReadLine()); // com 총 수 int m = int.Parse(Console.ReadLine()); /..
문제 https://www.acmicpc.net/problem/1926 1926번: 그림 어떤 큰 도화지에 그림이 그려져 있을 때, 그 그림의 개수와, 그 그림 중 넓이가 가장 넓은 것의 넓이를 출력하여라. 단, 그림이라는 것은 1로 연결된 것을 한 그림이라고 정의하자. 가로나 세로 www.acmicpc.net 코드 namespace dongsik { class Algorithm { static int n, m; static int[,] graph; static bool[,] visited; static int[] dx = { 1, -1, 0, 0 }; static int[] dy = { 0, 0, -1, 1 }; static void Main(string[] args) { // n * m 입력 받기 i..
문제 코드 using System; using System.Text; using System.Collections.Generic; namespace dongsik { class Algorithm { static int n, m; // n * m static int[,] map; // 지도 static int[,] dist; // 거리 static bool[,] visited; // 방문처리 static int[] dx = {-1, 0, 1, 0}; // x좌표 이동 static int[] dy = {0, -1, 0, 1}; // y좌표 이동 private static void BFS(int x, int y) { Queue queue = new Queue(); // queue queue.Enqueue(ne..
문제 https://www.acmicpc.net/problem/2110 코드 using System; using System.Text; using System.Collections.Generic; namespace dongsik { class Algorithm { static void Main(string[] str) { int[] nArr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); int num = nArr[0]; int total = nArr[1]; int[] houses = new int[num]; for(int i = 0; i < num; i++) { houses[i] = int.Parse(Console.ReadLine()); }..
문제 https://www.acmicpc.net/problem/10815 코드 using System; using System.Text; using System.Collections.Generic; namespace dongsik { class Algorithm { static void Main(string[] str) { int n = int.Parse(Console.ReadLine()); int[] nArr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); Array.Sort(nArr); int m = int.Parse(Console.ReadLine()); int[] mArr = Array.ConvertAll(Console.ReadLine(..
문제 https://www.acmicpc.net/problem/1654 1654번: 랜선 자르기 첫째 줄에는 오영식이 이미 가지고 있는 랜선의 개수 K, 그리고 필요한 랜선의 개수 N이 입력된다. K는 1이상 10,000이하의 정수이고, N은 1이상 1,000,000이하의 정수이다. 그리고 항상 K ≦ N 이다. 그 www.acmicpc.net 이진 탐색이다. 코드 using System; using System.Text; using System.Collections.Generic; namespace dongsik { class Algorithm { static void Main(string[] str) { int[] input = Array.ConvertAll(Console.ReadLine().Spli..
문제 https://www.acmicpc.net/problem/2805 2805번: 나무 자르기 첫째 줄에 나무의 수 N과 상근이가 집으로 가져가려고 하는 나무의 길이 M이 주어진다. (1 ≤ N ≤ 1,000,000, 1 ≤ M ≤ 2,000,000,000) 둘째 줄에는 나무의 높이가 주어진다. 나무의 높이의 합은 항상 M보 www.acmicpc.net 코드 using System; using System.Text; using System.Collections.Generic; namespace dongsik { class Algorithm { static void Main(string[] str) { int[] input = Array.ConvertAll(Console.ReadLine().Split('..
이동식이
'동식이 취업시키기 작전/코딩테스트' 카테고리의 글 목록 (2 Page)