[BOJ] [python] 14888: 연산자 끼워넣기
Idea주어진 수열과 각 사칙 연산의 가능한 횟수를 입력 받아, 모든 가능한 경우의 수를 탐색하며 최대값과 최소값을 갱신하는 깊이 우선 탐색(DFS) 기법을 사용한다. 입력 :N: 수열의 길이num_arr: 수열의 요소들add, sub, mul, div: 각각 더하기, 빼기, 곱하기, 나누기 연산을 수행할 수 있는 횟수초기 설정:maximun을 매우 작은 수로 설정하여 결과 중 최대값을 저장minimum을 매우 큰 수로 설정하여 결과 중 최소값을 저장첫 번째 숫자를 결과로 초기화하고, dfs 함수를 첫 번째 요소 다음 인덱스에서 시작 import sysdef dfs(depth, result, add, sub, mul, div): global maximun, minimum if depth == N: ..
[BOJ] [python] 2941: 크로아티아 알파벳
코드1오류1: 문자열은 Python에서 불변 객체(immutable)croba=['c=','c-','dz=','d-','lj','nj','s=','z=']word=input()answer=0for x in croba: if str(x) in word: word.replace(str(x),'') answer+=1print(word)print(answer) ljes=njak3 croba=['c=','c-','dz=','d-','lj','nj','s=','z=']word=input()answer=0for x in croba: if str(x) in word: print(str(x)) new_word=word.replace(str(x),'') ..