원티드

개발/문제풀이

[BOJ 27211, Python] 도넛 행성 풀이

import sys from collections import deque input = sys.stdin.readline dx = [0,0,1,-1] dy = [1,-1,0,0] matrix = [] n,m = map(int,input().split()) for _ in range(n): matrix.append(list(map(int,input().split()))) count = 0 def bfs(sx,sy): queue = deque() queue.append((sx,sy)) matrix[sy][sx] = 1 while queue: nx,ny = queue.popleft() for i in range(4): tx,ty = nx+dx[i], ny+dy[i] if(tx == -1): tx = m - 1..

개발/문제풀이

[BOJ 27210, Python] 신을 모시는 사당 풀이

import sys input = sys.stdin.readline s_num = int(input()) s_list = list(map(int,input().split())) m_list = [] before_s = s_list[0] count = 0 if before_s == 1: count += 1 else: count -= 1 for i in range(1,s_num): if s_list[i] != before_s: before_s = s_list[i] m_list.append(count) count = 0 if before_s == 1: count += 1 else: count -= 1 else: if s_list[i] == 1: count += 1 else: count -= 1 m_list.a..

Junhyung-Choi
'원티드' 태그의 글 목록