파싱

푼 날짜 : 2024.12.09푼 문제 : [5430] / AC사용한 언어 : python알고리즘 : 문자열, 파싱, 덱  접근방식 :처음에는 배열을 수행 값 마다 변경해서 시간 초과가 났다.따라서 인덱스 위치와 방향 값만 체크 후 그에 따라 출력을 해주었다.   코드 :import sysinput = sys.stdin.readlineT = int(input())for _ in range(T): p_list = list(input().rstrip()) n = int(input()) n_list = list(input().rstrip()) lst = [] # 문자열로 받은 숫자 처리를 위함 now_str = '' for i in n_list: if ..
푼 날짜 : 2024.08.19푼 문제 : [20291] / 파일정리사용한 언어 : python  푼 방법 :dot(.)을 기준으로 파싱하여 딕셔너리에 개수를 함께 저장하였다.확장자를 사전 순으로 정리해야 하므로 딕셔너리의 items()를 기준으로 정렬하여 출력하였다.  코드 : import sysN = int(sys.stdin.readline())myDict = {}for _ in range(N): file = sys.stdin.readline().rstrip() extension = file.split('.')[1] if extension in myDict: myDict[extension] +=1 else: myDict[extension] = 1 for name, num ..
__narrrrrmm
'파싱' 태그의 글 목록