목록DFS (2)
일상 코딩
maze.py from enum import Enum from typing import List, NamedTuple, Callable, Optional import random from math import sqrt from urllib.parse import MAX_CACHE_SIZE from generic_search import dfs, node_to_path, Node #, bfs, astar class Cell(str, Enum): EMPTY = " " BLOCKED = "X" START = "S" GOAL = "G" PATH = "*" class MazeLocation(NamedTuple): row: int column: int class Maze: def __init__(self, rows..

https://www.acmicpc.net/problem/1074 1074번: Z 한수는 크기가 2N × 2N인 2차원 배열을 Z모양으로 탐색하려고 한다. 예를 들어, 2×2배열을 왼쪽 위칸, 오른쪽 위칸, 왼쪽 아래칸, 오른쪽 아래칸 순서대로 방문하면 Z모양이다. N > 1인 경우, 배열을 www.acmicpc.net N,r,c = map(int, input().split()) def Z(size, x,y): if size == 1: return 0 size = size // 2 for i in range(2): for j in range(2): if x < size * (i+1) and y < size *(j+1): return (2*i + j)*(size**2) + Z(size, x-i*size, ..