[백준 c#] 24060번 알고리즘 수업 - 병합 정렬 1
·
c#/백준알고리즘
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Project2 { public static class Class1 { public static int count = 0; public static int ans = 0; static void merge_sort(int[] intArr, int p, int r, int num1, int[] temp) { //q는 중간값 if (p < r) { int q = (p + r) / 2; merge_sort(intArr, p, q, num1, temp); mer..
[백준 2798번 c#] 블랙잭
·
c#/백준알고리즘
브루트포스 알고리즘 이 쓰인 문제이다. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Project2 { class Class1 { static void Main(string[] args) { //N,M 값 입력 string[] N_M = Console.ReadLine().Split(); int N = int.Parse(N_M[0]); int M = int.Parse(N_M[1]); //카드에 쓰여진 수 입력 string[] nums = Console.ReadLine().Split(); int[] numsInt = new int..
[백준 11653번 c#] 소인수분해 구하기
·
c#/백준알고리즘
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Numerics; public class Program { public static void Main() { //정수 N 소인수분해하기 int N = int.Parse(Console.ReadLine()); for(int i=2; i
[백준 10757번 c#] 큰 수 A+B
·
c#/백준알고리즘
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Numerics; public class Program { public static void Main() { String[] str = Console.ReadLine().Split(' '); BigInteger a = BigInteger.Parse(str[0]); BigInteger b = BigInteger.Parse(str[1]); Console.WriteLine(a + b); } } c# 에서는 using System.Numerics; 에서 BigInteger을 통해 큰 수를 사..
[백준 2577번 c#] 숫자의 개수
·
c#/백준알고리즘
using System; using System.Text; public class Program { public static void Main() { StringBuilder sb = new StringBuilder(); int a= int.Parse(Console.ReadLine()); int b= int.Parse(Console.ReadLine()); int c= int.Parse(Console.ReadLine()); int a_b_c = a * b * c; String abc = a_b_c.ToString(); int[] abc2 = new int[abc.Length]; int[] answer = new int[10]; for (int i = 0; i < abc.Length; i++) { abc2[..
[백준15552번 c#] 빠른 A+B
·
c#/백준알고리즘
'빠른' 이 핵심 포인트이다 using System; using System.Text; public class Program { public static void Main() { int T = int.Parse(Console.ReadLine()); int[] a = new int[T]; int[] b = new int[T]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < T; i++) { String[] strings = Console.ReadLine().Split(' '); a[i] = int.Parse(strings[0]); b[i] = int.Parse(strings[1]); sb.Append(a[i] + b[i]+"\n"); } Cons..