본문 바로가기
반응형

코딩테스트 준비211

백준 C# 9080 using System; namespace baek2 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); int T = int.Parse(input); for(int i = 0; i < T; i ++) { string input2 = Console.ReadLine(); char first = input2[0]; char last = input2[input2.Length-1]; Console.WriteLine($"{first}{last}"); } } } } 2023. 4. 26.
백준 C# 2743 String메서드 알아보러가기 C# - String (찾기, 변형, 분할, 제거 메서드) 1. 찾기 01 Contains 특정 문자열이 문자열안에 있는지 확인 public bool Contains (string value); 반환 Boolean : 문자열이 있으면 true 없으면 false 를 반환한다. string name = "Pink Pig"; bool found = name.Contains("Pink"); Con code-piggy.tistory.com using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace baek2 { class Program { static void Main(s.. 2023. 4. 21.
백준 C# 27866 String 메서드 알아보러 가기 C# - String (찾기, 변형, 분할, 제거 메서드) 1. 찾기 01 Contains 특정 문자열이 문자열안에 있는지 확인 public bool Contains (string value); 반환 Boolean : 문자열이 있으면 true 없으면 false 를 반환한다. string name = "Pink Pig"; bool found = name.Contains("Pink"); Con code-piggy.tistory.com using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace baek2 { class Program { static void Main.. 2023. 4. 21.
백준 C# 1546 List메서드 알아보러 가기 C# - List 메서드 List를 사용하기 위해서는 System.Collections.Generic 네임스페이스를 추가해줘야한다. using System.Collections.Generic; List pig = new List(); 1. Add List 끝 부분에 추가 public void Add (T item); List pig = new List(); pig.Add(2); code-piggy.tistory.com using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace baek2 { class Program { static void Main(string[] .. 2023. 4. 21.
백준 C# 10811 List 메서드 알아보러 가기 C# - List 메서드 List를 사용하기 위해서는 System.Collections.Generic 네임스페이스를 추가해줘야한다. using System.Collections.Generic; List pig = new List(); 1. Add List 끝 부분에 추가 public void Add (T item); List pig = new List(); pig.Add(2); code-piggy.tistory.com using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace baek2 { class Program { static void Main(string[].. 2023. 4. 18.
C# - 중복된 값 제거하기 1. Contains을 사용하기 foreach(int i in list) { if (answer.Contains(i)) continue; answer.Add(i); } 2. Distinct 메서드 사용하기 Distnict 메서드는 System.Linq 네임스페이스에 있으므로 using문에 System.Linq를 추가한다. using System.Linq; List answer = list.Distinct().ToList(); OR var answer = list.Distinct(); 2023. 4. 18.
반응형