분류 전체보기(159)
-
C# 숫자 문자열과 영단어
using System; using System.Collections.Generic; public class Solution { public int solution(string s) { Dictionary num = new Dictionary(); num.Add("zero", 0); num.Add("one", 1); num.Add("two", 2); num.Add("three", 3); num.Add("four", 4); num.Add("five", 5); num.Add("six", 6); num.Add("seven", 7); num.Add("eight", 8); num.Add("nine", 9); string s2 = ""; foreach (var item in num) { s = s.Replace(i..
2022.03.22 -
C# 신고 결과 받기
코드 : using System; public class Solution { public static void Reset2(int[,] array) //초기화 { for (int i = 0; i < array.GetLength(0); i++) { for (int j = 0; j < array.GetLength(1); j++) { array[i, j] = 0; } } } public static void Reset(int[] array) //초기화 { for (int i = 0; i < array.Length; i++) { array[i] = 0; } } public int[] solution(string[] id_list, string[] report, int k) { int[] answer = new ..
2022.03.22 -
C# 7576번 토마토
using System; using System.Collections.Generic; namespace _6 { class Program { static int N, M; //맵 저장 행렬 static int[,] map = new int[1001, 1001]; //방문 확인 행렬 static bool[,] visited = new bool[1001, 1001]; static int[,] disMap = new int[1001, 1001]; static Queue queue = new Queue(); static int[] dx = { -1, 1, 0, 0 }; static int[] dy = { 0, 0, -1, 1 }; static void Reset() //초기화 { for (int i = 0; i..
2022.03.13 -
C# 2178번 미로 탐색
코드 : using System; using System.Collections.Generic; namespace _3 { class Program { static int N,M; //맵 저장 행렬 static int[,] map = new int[101, 101]; //방문 확인 행렬 static bool[,] visited = new bool[101, 101]; //시작점부터의 거리를 저장하는 행렬 static int[,] disMap = new int[101, 101]; static Queue queue = new Queue(); static int[] dx = { -1, 1, 0, 0 }; static int[] dy = { 0, 0, -1, 1 }; static void Reset() //방문배열..
2022.03.12 -
C# 1012번 유기농 배추
코드 : using System; using System.Collections.Generic; namespace _4 { class Program { static int T,M,N,K; //맵 저장 행렬 static int[,] map = new int[51, 51]; //방문 확인 행렬 static bool[,] visited = new bool[51, 51]; static Queue queue = new Queue(); static int[] dx = { -1, 1, 0, 0 }; static int[] dy = { 0, 0, -1, 1 }; //배추흰지렁이 수 static int count; static void Reset() //초기화 { count = 0; for (int i = 0; i < M..
2022.03.12 -
C# 2667번 단지번호붙이기
코드 : using System; using System.Collections.Generic; namespace _3 { class Program { static int N; //맵 저장 행렬 static int[,] map = new int[26, 26]; //단지내의 집의 수 저장 행렬 static int[] houseCount = new int[1000]; //방문 확인 행렬 static bool[,] visited = new bool[26,26]; static Queue queue = new Queue(); static int[] dx = { -1, 1, 0, 0 }; static int[] dy = { 0, 0, -1, 1 }; //단지수 static int count = 0; //단지내의 집수..
2022.03.04