본문 바로가기
728x90

알고리즘/백준 BOJ119

[BOJ C#] 2798 블랙잭 using System; using System.Collections.Generic; using System.Linq; using System.IO; namespace _2798 { class Program { static void Main() { StreamReader sr = new StreamReader(Console.OpenStandardInput()); StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()); string[] nm = sr.ReadLine().Split(' '); int n = int.Parse(nm[0]); int m = int.Parse(nm[1]); string[] cardString = sr.ReadLine()... 2023. 1. 25.
[BOJ C#] 2775 부녀회장이 될테야 using System; using System.Text; using System.IO; namespace _2775 { class Program { static void Main() { StreamReader sr = new StreamReader(Console.OpenStandardInput()); StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()); StringBuilder sb = new StringBuilder(); int t = int.Parse(sr.ReadLine()); for(int i = 0; i < t; i++) { int k = int.Parse(sr.ReadLine()); int n = int.Parse(sr.Read.. 2023. 1. 25.
[BOJ C#]11659 구간 합 구하기 4 using System; namespace _11659 { class Program { static void Main(string[] args) { int[] arr = { 0, 5, 4, 3, 2, 1 }; int[] sumarr = new int[5 + 1]; // 합배열 만들기 // sumarr[i] = sumarr[i-1] + arr[i] sumarr[0] = arr[0]; for (int i = 1; i < arr.Length; i++) { sumarr[i] = sumarr[i - 1] + arr[i]; } for (int i = 0; i < 6; i++) { Console.Write("{0,2} ", arr[i]); } Console.WriteLine(); for (int i = 0; i < .. 2023. 1. 16.
[BOJ C#] 11720 숫자의 합 using System; namespace _11720 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string strnum = Console.ReadLine(); string str; int sum = 0; for (int i = 0; i < N; i++) { str = strnum[i].ToString(); sum += int.Parse(str); } Console.WriteLine(sum); } } } 2023. 1. 15.
[BOJ C#] 10988 팰린드롬 using System; using System.Linq; namespace _10988 { class Program { static void Main(string[] args) { string str = Console.ReadLine(); string strReverse = new string(str.Reverse().ToArray()); int palindrome = (str == strReverse) ? 1 : 0; Console.WriteLine(palindrome); } } } 2023. 1. 15.
[BOJ C#] 1181 단어 정렬 case #1 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _1181 { class App { //생성자 public App() { string[] arr = { "but", "i", "wont", "hesitate", "no", "more", "no", "it", "cannot", "wait", "im", "your" }; //여기부터 작성하세요 for(int i = 1; i < arr.Length; i++) { var strs = from str in arr where str.Length==i orderby str asce.. 2023. 1. 12.
728x90