코딩 테스트 29

C# 1181 단어 정렬

using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace Study11 { class App { //생성자 public App() { string[] arr = { "but", "i", "wont", "hesitate", "no", "more", "no", "it", "cannot", "wait", "im", "your" }; //여기부터 작성하세요 string[] distinctArr = arr.Distinct().ToArray(); //먼저 중복 제거한 배열을 만들었다 IOrderedEnumerable query = from word in distinctArr orderby word.Leng..

C# 10173 니모를 찾아서

먼저 니모가 가질 수 있는 문자열의 모든 경우를 nemo 배열에 넣었다 arr 배열의 문자열 안에 nemo배열의 값을 포함하고 있는지 찾게 했다 하나라도 포함하고 있으면 true가 반환되므로 for문 종료하고 결과를 출력하게 만들었다 포함하고 있지 않으면 for문 마지막까지 돌고 결과 출력한다 using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace Study11 { class App { //생성자 public App() { //[BOJ] 10173 니모를 찾아서 string[] arr = { "Marlin names this last egg Nemo, a name that Coral liked..

C# 4458 첫 글자를 대문자로

구글에 'C# 첫 글자를 대문자로'라고 검색해서 나온 https://learn.microsoft.com/ko-kr/dotnet/api/system.globalization.textinfo.totitlecase?view=net-7.0 TextInfo.ToTitleCase(String) 메서드 (System.Globalization) 지정된 문자열에서 단어의 첫 글자를 대문자로 변환합니다(약어로 간주되는 모두 대문자로 이루어진 단어 제외). learn.microsoft.com 이 메서드를 이용해서 작성했다 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Globalization; na..

C# 2711 오타맨 고창영

using System; using System.Collections.Generic; namespace Study11 { class App { //생성자 public App() { //boj 2711 오타맨 고창영 Dictionary dic = new Dictionary(){ { 4, "MISSPELL" }, { 1, "PROGRAMMING" }, { 7, "CONTEST" }, { 3, "BALLOON" }, }; //여기서부터 작성 //틀린 위치와 문장을 저장하기 위한 변수 int wrongPosition = 0; string wrongSentence = null; foreach (KeyValuePair pair in dic) { wrongPosition = pair.Key; wrongSentence..

C# 9086 문자열

using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.IO; namespace Study11 { class App { //생성자 public App() { //boj 9086 문자열 string[] arr = { "ACDKJFOWIEGHE", "O", "AB" }; //여기서부터 코드 작성 char start = 'a'; char end = 'a'; for (int i = 0; i < arr.Length; i++) { start = arr[i][0]; //배열 arr의 i번째 값의 첫번째 값 저장 end = arr[i][arr[i].Length - 1]; //배열 arr의 i번째 값..

C# 15828 라우터

테스트케이스1 using System; using System.Collections.Generic; using System.Linq; using System.Collections; namespace Study10 { class App { int n = 5; int[] arr = { 1, 2, 0, 3, 4, 0, 5, 6, 0, 0, -1 }; //생성자 public App() { //여기서부터 작성 하세요 for (int i = 0; i = n && arr[i] == 0) //라우터가 가득 찼는데 이번 값이 0이면 큐에 있던 패킷 처리 { q.Dequeue(); continue; } if (q.Count >= n) //라우터가 가득 찼는데 이..

반응형