코딩테스트 문제 풀이/[백준] 기본 수학2(11)
-
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 -
C# 백준 2581번 소수
코드 : 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 M = Convert.ToInt32(Console.ReadLine()); int N = Convert.ToInt32(Console.ReadLine()); int number = 0; int sum = 0; int[] array = new int[1]; array[0] = 0; for (int i = M; i
2022.01.03 -
C# 백준 1978번 소수찾기
코드 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _1 { internal class Program { static void Main(string[] args) { //1 3 5 7 전체길이 = 4, number = 1, 출력 = 3 int N = Convert.ToInt32(Console.ReadLine()); string input = Console.ReadLine(); string[] inputdata = input.Split(' '); int number = 0; //소수가 아닌값들을 찾아서 전체 길이에서 빼기 fo..
2022.01.03