15739번 - 매직스퀘어
int[] inputs; try { inputs = Console.ReadLine().Split().Select(int.Parse).ToArray(); } catch (FormatException) { while (true) { Console.WriteLine("badFormat"); } }
^ 출력 초과
int[] inputs; try { inputs = Console.ReadLine().Split().Select(int.Parse).ToArray(); } catch (FormatException) { Console.Write("what the heck"); return; }
^ 틀렸습니다
런타임 에러는 제 코드보다 입력 형식 먼저 의심해 보는게 빠를 지경이네요..
이분 탐색 비슷하게 들어오는 입력 개수 확인해서 입력 이상하게 들어오는 케이스 2개를 확인하고 그거만 예외처리하니 맞았습니다.
string[] temp = Console.ReadLine().Trim().Split(); if (temp.Length != n) { if (temp.Length >= 100) { Console.WriteLine("TRUE"); return; } else { Console.WriteLine("FALSE"); return; } }
재채점했습니다.
댓글을 작성하려면 로그인해야 합니다.
paraworld 3년 전 1
^ 출력 초과
^ 틀렸습니다
런타임 에러는 제 코드보다 입력 형식 먼저 의심해 보는게 빠를 지경이네요..
이분 탐색 비슷하게 들어오는 입력 개수 확인해서 입력 이상하게 들어오는 케이스 2개를 확인하고 그거만 예외처리하니 맞았습니다.