[BaekJoon] 1107 리모컨
·
💯 CodingTest/BaekJoon
▶ 문제 : 더보기 https://www.acmicpc.net/problem/1107 ▶ 코드 : N = int(input()) M = int(input()) if M > 0 : errorBtn = list(map(int, input().split())) else: errorBtn =[] answer = abs(100 - N) for num in range(1000001): # 최대 N은 500,000 까지 입력이 가능하며 같은 자리로 생각했을때 1,000,000 까지 입력이 가능하므로 범위를 이와 같이 설정 # 1,000,000을 넘어가는 숫자부터는 0 ~ 500,000사이의 숫자로 커버 가능 count = 0 for c in str(num): if int(c) in errorBtn: break els..
[BaekJoon] 1074번 Z
·
💯 CodingTest/BaekJoon
▶ 문제 더보기 https://www.acmicpc.net/problem/1074 ▶ 코드 N, r, c = map(int, input().split()) l = 2 ** N def recursiveZ (x, y, l, startIndex): global answer, r, c if l == 2: if (x,y) == (r,c): answer = startIndex elif (x,y+1) == (r,c): answer = startIndex + 1 elif (x+1,y) == (r,c): answer = startIndex + 2 elif (x+1,y+1) == (r,c): answer = startIndex + 3 elif l > 2 : dividedL = l // 2 if r < dividedL an..
[BaekJoon] 1012 유기농 배추
·
💯 CodingTest/BaekJoon
▶ 문제 : 더보기 https://www.acmicpc.net/problem/1012 import sys t = int(input()) sys.setrecursionlimit(10**6) def dfs(a, b): if a = m or b = n: return if graph[a][b] == 0: return graph[a][b] = 0 dfs(a - 1, b) dfs(a, b - 1) dfs(a + 1, b) dfs(a, b + 1) for _ in range(t): m, n, k = map(int, input().split()) graph = [[0 for _ in range(n)]for _ in range(m)] for _ in range(k): a, b = ma..
[BaekJoon] 1003 피보나치 함수
·
💯 CodingTest/BaekJoon
▶ 문제 더보기 https://www.acmicpc.net/problem/1003 import sys n = int(sys.stdin.readline().rstrip()) data = {i : 0 for i in range(41)} # 숫자의 최대값이 40 result = [[0, 0] for i in range(41)] result[0][0] = 1 result[1][1] = 1 def fibo(n): if n == 0: return 0 elif n == 1: return 1 elif data[n] > 0: return data[n] else: data[n] = fibo(n-1) + fibo(n-2) result[n][0], result[n][1] = result[n-1][0] + result[n-2]..
[BaekJoon] 18111 마인크래프트
·
💯 CodingTest/BaekJoon
import sys n, m, b = map(int,sys.stdin.readline().rstrip().split()) groundHeight = [list(map(int,sys.stdin.readline().rstrip().split())) for i in range(n)] #numOfH ={i:0 for i in range(257)} linearGround = [] minH = 256 maxH = 0 for raw in groundHeight : if min(raw) maxH: maxH = max(raw) for h in raw: linearGround.append(h) linearGround.sort(reverse=True) ..