코딩테스트 문제 풀이/[백준] 동적 계획법1(7)
-
C# 10844번 쉬운 계단 수
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace _5 { class Program { static void Main(string[] args) { int N = Convert.ToInt32(Console.ReadLine()); long[,] arr = new long[10, 101]; long sum = 0; //초기값 for (int i = 0; i < 10; i++) { arr[i, 1] = 1; } for (int i = 2; i
2022.01.22 -
C# 1932번 정수 삼각형
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _6 { class Program { static int N; static int[] outputTable; static int[,] IntTriangle; static int[,] LeftTriangle; static int[,] RightTriangle; static int[,] TotalTriangle; static void Main(string[] args) { { N = int.Parse(Console.ReadLine()); //현재 정수 배열 IntTriangle..
2022.01.22 -
C# 1149번 RGB거리
코드 : using System; namespace PracticeAlgo { class Program { static int N; static int[,] ColorCost; static int[,] totalCost; static void Main(string[] args) { { N = int.Parse(Console.ReadLine()); //현재 비용 배열 ColorCost = new int[N, 3]; //최소 비용 저장 배열 totalCost = new int[N, 3]; for (int n = 0; n < N; n++) { var buf = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); //2차원배열 채우기 ColorCost[n,..
2022.01.22 -
C# 9461번 파도반 수열
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _4 { class Program { static void Main(string[] args) { int T = Convert.ToInt32(Console.ReadLine()); double[] P = new double[101]; P[1] = 1; P[2] = 1; P[3] = 1; P[4] = 2; P[5] = 2; for (int i = 0; i < T; i++) { int N = Convert.ToInt32(Console.ReadLine()); for (int j =..
2022.01.22 -
C# 1904번 01타일
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _3 { class Program { static void Main(string[] args) { int N = Convert.ToInt32(Console.ReadLine()); int[] tileCount = new int[1000001]; tileCount[1] = 1; tileCount[2] = 2; for (int i = 3; i
2022.01.22 -
C# 9184번 신나는 함수 실행
코드 : using System; namespace PracticeAlgo { class Program { static int[,,] w; static void Main(string[] args) { using (var prnt = new System.IO.StreamWriter(Console.OpenStandardOutput())) { w = new int[101, 101, 101]; while (true) { var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); if (a[0] == -1 && a[1] == -1 && a[2] == -1) { break; } if (w[a[0] + 50, a[1] + 50, a[2] + 50] == ..
2022.01.22