코딩테스트 문제 풀이(88)
-
C# 백준 3009번 네 번째 점
코드 : using System; namespace _8 { class Program { static void Main(string[] args) { string input1 = Console.ReadLine(); string[] input1data = input1.Split(' '); string input2 = Console.ReadLine(); string[] input2data = input2.Split(' '); string input3 = Console.ReadLine(); string[] input3data = input3.Split(' '); int x1, x2, x3; int y1, y2, y3; x1 = Convert.ToInt32(input1data[0].ToString()); x2 ..
2022.01.03 -
C# 백준 1085번 직사각형에서 탈출
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _7 { internal class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] inputdata = input.Split(' '); //2 1 4 4 int x = Convert.ToInt32(inputdata[0]); int y = Convert.ToInt32(inputdata[1]); int w = Convert.ToInt32(inputdata[2]); in..
2022.01.03 -
C# 백준 9020번 골드바흐의 추측
using System; using System.Text; using System.Collections.Generic; namespace _6 { internal class Program { static void Main(string[] args) { int T = Convert.ToInt32(Console.ReadLine()); for (int K = 0; K < T; K++) { int input = Convert.ToInt32(Console.ReadLine()); int first = 0; int second = 0; int firstSave = 0; int secondSave = 0; int difference = 10000; List deArray = decimalArray(input); for..
2022.01.03 -
C# 백준 4948번 베트르탕 공준
코드 : using System; namespace _5 { internal class Program { static void Main(string[] args) { while(true) { int input = Convert.ToInt32(Console.ReadLine()); if (input == 0) break; int num = 0; for (int i = input+1; i
2022.01.03 -
C# 백준 1929번 소수 구하기 stringBuilder활용
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _4 { internal class Program { static void Main(string[] args) { StringBuilder sb = new StringBuilder(); string input = Console.ReadLine(); string[] inputdata = input.Split(' '); int M = Convert.ToInt32(inputdata[0]); int N = Convert.ToInt32(inputdata[1]); List desima..
2022.01.03 -
C# 백준 11653번 소인수분해
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _2 { internal class Program { static void Main(string[] args) { int N = Convert.ToInt32(Console.ReadLine()); List Factorization = new List(); int num = 2; while (N > 1) { if (N % num == 0) { N = N / num; Factorization.Add(num); } else num++; } foreach (var item in Fa..
2022.01.03