백준 9184 : 신나는 함수 실행 (파이썬)
신나는 함수 실행 시간 제한 메모리 제한 제출 정답 맞힌 사람 정답 비율 1 초 128 MB 20643 8926 6757 42.008% 문제 재귀 호출만 생각하면 신이 난다! 아닌가요? 다음과 같은 재귀함수 w(a, b, c)가 있다. if a 20, then w(a, b, c) returns: w(20, 20, 20) if a < b and b < c, then w(a, b, c) returns: w(a, b, c-1) + w(a, b-1, c-1) - w(a, b-1, c) otherwise it returns: w(a-1, b, c) + w(a-1, b-1, c) + w(a-1, b, c-1) - w(a-1, b-1, c-1) 위의 함수를 구현하는 것은 매우 쉽다. 하지만, 그대로 구현하면 값을 구..
2022. 2. 7.
백준 14888 : 연산자 끼워넣기 (파이썬)
연산자 끼워넣기https://www.acmicpc.net/problem/14888풀이 코드# https://teching.tistory.com/import sysn = int(sys.stdin.readline().rstrip())nums = list(map(int,sys.stdin.readline().split()))#operator 0: +, 1: -, 2: *, 3: /operator = list(map(int,sys.stdin.readline().split()))use_operator = [0, 0, 0, 0]answerMax = -1000000000answerMin = 1000000000def solve(idx,res): global n, answerMin, answerMax if i..
2022. 2. 5.