다익스트라 탬플릿 코드
from heapq import heappush, heappopv, e = map(int, input().split())st = int(input())graph = [[] for _ in range(v + 1)]distance = [99999999] * (v + 1)distance[0] = 0for i in range(e): x, y, val = map(int, input().split()) graph[x].append([val, y])def dijkstra(graph, num, distance): q = [] heappush(q, [0, num]) distance[num] = 0 while q: w, number = heappop(q) if w ..
dfs, bfs 탬플릿 코드
DFS (좌표 형태 순회용)def dfs(x, y): dx = [-1, 0, 1, 0] dy = [0, 1, 0, -1] for i in range(4): nx = x + dx[i] ny = y + dy[i] if isRectangle(nx, ny) and copyed_maps[nx][ny] == 1 and chk[nx][ny] == -1: chk[nx][ny] = 1 dfs(nx, ny)def isRectangle(x, y): if 0 DFS ( 노드와 노드 순회용)n = int(input())connects = int(input())connectList = [[0] * (n + 1) for _ in r..
맨날 헷갈리는 PaaS, IaaS, SaaS 요약
PaaS (Platform as a Service)설명: 애플리케이션 개발 및 배포를 위한 플랫폼을 제공하는 서비스.예시: Heroku, Google App Engine.주요 기능: 개발 환경, 데이터베이스 관리, 미들웨어 등.IaaS (Infrastructure as a Service)설명: 가상화된 컴퓨팅 자원을 제공하는 서비스.예시: Amazon Web Services (AWS), Microsoft Azure.주요 기능: 서버, 스토리지, 네트워크 자원.SaaS (Software as a Service)설명: 인터넷을 통해 소프트웨어를 제공하는 서비스.예시: Google Workspace, Salesforce.주요 기능: 소프트웨어 접근, 유지관리, 업데이트.각 서비스의 핵심은 다음과 같습니다:Pa..
다익스트라 알고리즘 - 배열에 cost가 주어질 시 탬플릿 코드
import heapq import sys input = sys.stdin.readline cnt = 1 INF = int(1e9) dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def dijkstra(): q = [] heapq.heappush(q, (graph[0][0], 0, 0)) distance[0][0] = 0 while q: cost, x, y = heapq.heappop(q) if x == n - 1 and y == n - 1: print(f'Problem {cnt}: {distance[x][y]}') break for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0