본문 바로가기

분류 전체보기146

백준 #1316 2023-07-27 문제를 보고 뭔소린가 했더니,,, 해당 블로그를 보고 드디어 이해를 하였습니다,, https://hyunsun99.tistory.com/142 처음엔 따라한 코드 int count = int.Parse(Console.ReadLine()); //입력 int sum = count; //합계 bool isNext = false; //체크 여부 for(int i = 0; i < count; i++) { isNext = false; //초기화 string put = Console.ReadLine(); //문자열 입력 for(int j = 0; j < put.Length - 1; j++) { if(isNext) break; //이미 true일경우 탈출 if(put[j] == put[j + 1]) continue; .. 2023. 7. 27.
백준 #2941 2023-07-26 Regex regex = new Regex(@"(c=)|(c-)|(dz=)|(d-)|(lj)|(nj)|(s=)|(z=)"); //정규식 string input = regex.Replace(Console.ReadLine(),"1"); //1로 변환 Console.WriteLine(input.Length); // ----------------------------------------------------------------------------------------------- string put = Console.ReadLine(); string[] crotia = new string[] { "c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z=" }; //배열에 저장 fo.. 2023. 7. 26.
백준 #1157 2023-07-25 코드를 짧게 한답시고 해봤는데 소요시간이 246ms인가 나와서 슬펐습니당,,,,, string put = Console.ReadLine(); //입력 Dictionary putDictionary = new Dictionary(); //딕셔너리에 한 번 이상 나온 데이터만 추가 for(int i = 0; i putDictionary[n] == max); //최대값의 문자 저장 if (putDictionary.Values.Count(n => n == max) > 1) //1 초과할경우 2개이상으로 간주 Console.Write("?"); else Console.Write(string.Concat(test)); //char에서 string으로 ,,, new string(test); 이거도 될려나.. 2023. 7. 26.
백준#2444 2023-07-24 힘들게했는데,,, 입력 뒷줄에 공백이 들어가면 안됬었네요,,,, 이런.. StringBuilder stringBuilder = new StringBuilder(); int put = int.Parse(Console.ReadLine()); for(int i = 1; i = 1; i--) { if(i-1 = 1; i--) { if(i-1 2023. 7. 24.