분류 전체보기(159)
-
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 -
C# 1003번 피보나치 함수
코드 : using System; class Test{ public static void Main() { int num = Convert.ToInt32(Console.ReadLine()); int[] fibo = new int[41]; fibo[0] = 0; fibo[1] = 1; for (int i = 2; i < 41; i++) { fibo[i] = fibo[i-1] + fibo[i-2]; } for(int i = 0; i < num; i++) { int N = Convert.ToInt32(Console.ReadLine()); if(N == 0) Console.WriteLine("1 0"); else Console.WriteLine($"{fibo[N-1]} {fibo[N]}"); } } } 코드 설명..
2022.01.22 -
C# 14889번 스타트와 링크
using System; using System.Text; namespace beakjoon { class _8 { static int range, length; static int[] tempArr = new int[21]; // 값 출력을 위한 정수 배열 static int[] arr = new int[21]; // 값 출력을 위한 정수 배열 static string[] awaytemp = new string[21]; // 값 출력을 위한 정수 배열 static int[] awayArr = new int[21]; // 중복 제거를 위한 bool 배열 static bool[] visited = new bool[21]; // 2차원 배열 static int[,] all = new int[21, 21]; ..
2022.01.17